我想写<a href="product.php?id=5">
为 product/5。我不是在谈论用户键入 doamin.com/product/5 以获得结果,我正在寻找的是 - 当用户单击链接时,浏览器地址栏将显示 url作为 domain.com/product/5。
有可能吗?任何帮助将不胜感激。在此先感谢。
我想写<a href="product.php?id=5">
为 product/5。我不是在谈论用户键入 doamin.com/product/5 以获得结果,我正在寻找的是 - 当用户单击链接时,浏览器地址栏将显示 url作为 domain.com/product/5。
有可能吗?任何帮助将不胜感激。在此先感谢。
Just write:
<a href="/product/5">LINK</a>
What you also need is a .htaccess file, that handles mod_rewrite, for example:
# turn mod_rewrite engine on
RewriteEngine On
# rewrite all physical existing file or folder
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
# allow things that are certainly necessary
RewriteCond %{REQUEST_URI} "/css/" [OR]
RewriteCond %{REQUEST_URI} "/images/" [OR]
RewriteCond %{REQUEST_URI} "/images/" [OR]
RewriteCond %{REQUEST_URI} "/javascript/"
# rewrite rules
RewriteRule .* - [L]
RewriteRule (.*) index.php?_route=$1 [QSA]
With you'll get a $_GET['_route'] which's value will be /product/5. The rest is up to your php code to parse that string.