且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

php中没有文件名的动态URL

更新时间:2023-02-25 14:13:18

一小部分htaccess可以很容易地做到这一点.例如,将此规则保存在根目录的htaccess中:

A littlebit of htaccess can do it pretty easily. As for example, save this rule in the root directory's htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^/static_folder/index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /static_folder/index.php [L]
</IfModule>

然后在/static_folder/index.php 内使用 $ _ SERVER ['REQUEST_URI'] 来获取dynamic_parameter.这是您要达到的目标吗?

Then use $_SERVER['REQUEST_URI'] inside /static_folder/index.php to get the dynamic_parameter. Is it what you are trying to achieve?