[英]Display name in URL from sql
I am having a list of members in my database, which i want to display in my website. 我的数据库中有一个成员列表,我想显示在我的网站中。
I am using php GET method, and the sample url is 我正在使用php GET方法,示例网址是
com/members.php?id=454418
Can anyone please help me in getting url like 谁能帮我获得类似的网址
com/members/454418/steve-jobs
You need to use URL rewriting. 您需要使用URL重写。
Please check the Apache URL Rewriting Guide . 请检查Apache URL重写指南 。
You can use .htaccess
file.. 您可以使用
.htaccess
文件。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
in this example: 在此示例中:
com/members/454418 com / members / 454418
$_GET['url']
= 454418 $_GET['url']
= 454418
give it a try.. 试试看..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.