All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
ExtJS与.NET结合开发实例(Grid之新增——Form提交篇)_[Asp.Net教程]
用动态网页技术PHP生成验证码图片的源代码_[PHP教程]
用php自带函数去除html标签_php资料_编程技术
用CSS解决未知高度的DIV垂直居中的问题_[Html教程]
PHP实例:用PHP实现网页开发中的翻页跳转_php资料_编程技术
php和explode_php资料_编程技术
怎么将现有的网站过渡到XHTML_[Html教程]
asp.net,ajax客户端编程+jquery-实现泛型数据的客户端数据调用、添加、删除_[Asp.Net教程]
PHP中 ADODB 类库介绍(二)_[PHP教程]
PHP实例:PHP批量生成缩略图_[PHP教程]
Reading number is top 10 pictures
八个盛产美女的国家1
The little woman's bright wire2
The Soviet union swimsuit exposure in the 70 year3
西游日记4
西班牙山村小景2
Chinese paper-cut grilles art appreciation7
Catch prostitution woman in China
30 beautiful school beauty1
The terra-cotta warriors2
Sora aoi mirror memorial classics3
Download software ranking
dreamweaver8中文版
美女写真2
Unix video tutorial3
网络管理员第三版
Proficient in Eclipse
Unix video tutorial14
Boxer's Top ten classic battle4
Unix video tutorial1
The Bermuda triangle1
Tram sex maniac 2 (H) rar bag17
delv published in(发表于) 2013/12/29 4:46:10 Edit(编辑)
用php简单实现Search,Engine,Friendly的URL_php资料_编程技术

用php简单实现Search,Engine,Friendly的URL_php资料_编程技术

用php简单实现Search Engine Friendly的URL_php资料_编程技术-你的首页-uuhomepage.com

上次写了Search Engine Friendly的URL设计 - 俺在这个事上面折腾,要实现这个 http://www.myhost.com/foo.php?a=A&b=B&c=C -> http://www.myhost.com/foo.php/a/A/b/B/c/C的url转换,实际上还有不同的办法.

比如说我用的是虚拟主机,也想实现url优化,但是我没有服务器权限,这时候可以从PATH_INFO来下手.

访问http://www.myhost.com/foo.php/a/A/b/B/c/C这个url的时候,如果apache的AllowPathinfo已经打开,用php访问$_SERVER['PATH_INFO']可以获得a/A/b/B/c/C这串字符 这时候再用php加以解析:

PLAIN TEXTPHP:

if(!empty($_SERVER['PATH_INFO'])) {
$paths = explode('/', substr($_SERVER['PATH_INFO'], 1));
for($i = 0, $cnt = count($paths); $i <$cnt; $i++)
$_GET[$paths[$i]] = @(string)$paths[++$i];
}

这样就可以简单的将PATH_INFO转换为全局的$_GET数组,这样还有个好处

http://www.myhost.com/foo.php?a=A&b=B&c=C
http://www.myhost.com/foo.php/a/A/b/B/c/C
上面的url同时可以访问,保证了通用性





添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.