获取url中部份内容代码
发布:smiling 来源: PHP粉丝网 添加日期:2014-08-17 20:30:38 浏览: 评论:0
- function getpath($url)
- {
- $path = parse_url($url,php_url_path);
- $lastslash = strrpos($path,"/");
- return substr($path,1,$lastslash-1);
- }
- echo getpath("http://www.phpfensi.com/blog/entry-title/?standalone=1");
- //
- function getpathurl() {
- $folder = explode('/', $_server['script_name']);
- $script_filename = pathinfo($_server['script_name']);
- $request = explode('/', $_server['request_uri']);
- array_shift($folder);
- array_shift($request);
- $final_request = array_diff($request, array_intersect($folder, $request));
- $final_request = array_values($final_request);
- array_clean($final_request);
- $final_request = implode('/', $final_request);
- if ($_server['query_string'] || substr($final_request, -1) == '?') {
- $final_request = substr($final_request, 0, - strlen($_server['query_string']) - 1);
- }
- return $final_request;
- }
Tags: 获取url 部份内容
相关文章
- ·php 从字符串中获取URL中获得域名(2013-11-23)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)