北京中科皮肤医院好不好 https://jbk.39.net/yiyuanzaixian/bjzkbdfyy/xtxbdf_zx/fq5zm26/PHP伪静态前言在用PHP语言开发网站的时候,伪静态是一个绕不过去的一道坎,在PHP中设置伪静态对于老手来说是手到擒来,但是对于新手来说稍微有点难度,还没有掌握的小伙伴们不要着急,下面跟着小编一起来学习吧。正文一、Apache的伪静态配置1、网站根目录下需要有.htaccess文件,没有则自己创建一个,内容为IfModulemod_rewrite.c
RewriteEngineon
RewriteCond%{REQUEST_FILENAME}!-d
RewriteCond%{REQUEST_FILENAME}!-f
RewriteRule^(.*)index.php/1[QSA,PT,L]
/IfModule如果你的apache是fastcgi模式下,则需要修改RewriteRule^(.*)index.php/1[QSA,PT,L]替换成
RewriteRule^(.*)index.php[L,E=PATH_INFO:1]2、在apache的配置文件
rulename=OrgPagestopProcessing=true
matchurl=^(.*)/
conditionslogicalGrouping=MatchAll
addinput={HTTP_HOST}pattern=^(.*)/
addinput={REQUEST_FILENAME}matchType=IsFilenegate=true/
addinput={REQUEST_FILENAME}matchType=IsDirectorynegate=true/
/conditions
actiontype=Rewriteurl=index.php/{R:1}/
/rule
/rules
/rewrite结尾通过本文的学习各位小伙伴们对于PHP中如何设置伪静态是不是学会了,那好以后还需要小伙伴们自己多多练习探索啊。
转载请注明:http://www.aierlanlan.com/grrz/8673.html