我有这个url
http://example.net/test
但我有需要
http://example.net/test/info
在我的htaccess中有这段代码,
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*/([a-zA-Z0-9_-]+)|([a-zA-Z0-9_-]+))$ ./id.php?u=$1
如何使用像链接一样的代码
http://example.net/test/info
好的。我们解释一下。
htaccess:
Options All -Indexes
AddDefaultCharset utf-8
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?$1 [L]
php: var_dump(explode('/', explode('?', $_SERVER['REQUEST_URI'])[0]));
你可以使用这个部分来调用(通过路由器)你的站点的例程。控制器、方法、路由器的实现——许多且不同。我不知道你在干什么。我只建议你选择正确的方式。