php $ _GET没有变量
问题描述:
我想要的网址是http://something.com/somestring,其中somestring是由php $ _GET获取的,而不是必须在使用$ _GET [“var”]时编写http://something.com/index.php?var=somestring和php内部。
我该怎么做?
答
您的问题已经得到解答。但给你举个例子:
RewriteEngine
RewriteCond ./%{REQUEST_URI} !-f
RewriteRule ^(\w+)$ index.php?var=$1 [L]
第一个cond阻止规则将请求重写为真实文件。第二个采用任何字母数字字符串并将其作为GET参数附加到您的脚本。
答
可以使用的.htaccess mod_rewrite的,并要做到这一点,假设你使用的是Apache Web服务器作为 - >http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
感谢这工作的一种享受 – daidai 2011-03-31 13:00:37