mod_rewrite的PHP的MySQL [英] mod_rewrite php mysql
问题描述
我在mod_rewrite的真新,我一直在试图弄清楚这一点,但真的卡住。 p
这是我的问题。
I'm really new at mod_rewrite and i have been trying to figure this out but really stuck. p Here is my issue.
我有一个网页。 http://example.com/user/?s=81
?S = 81从数据库的用户ID读取。
I have a page http://example.com/user/?s=81 ?s=81 is reading from user id in the db.
我想有一个链接结果
http://example.com/nookie
在数据库中,我有一个名为场whatuser
等在该领域的81行,我有用户nookie
In the database i have a field called whatuser so on row 81 in that field i have user nookie
所以我想什么是DATABSE它在数据库中的哪些用户阅读
并从它创建EASI网址。
我有一个用户文件夹内也有几个PHP页面,所以我需要能够链接
他们像
So what i would like is to read from databse what user it is in database and create easi url from it. i have also several php pages inside that user folder so i need to be able to link to them like
example.com/nookie/step1.php
example.com/nookie/step2.php
我希望你明白我的意思在这里。
Cheerz!
/ Nookie
I hope you get my point here. Cheerz! /Nookie
推荐答案
据我所知,你不能用的mod_rewrite
查询数据库。
To my knowledge you can not query databases with mod_rewrite
.
怎么样把一个PHP脚本到 /用户/?S = 81
,中查找用户的姓名在数据库,然后重新定位用户 $ URL =/ $的用户名;
看到PHP的头功能的传递位置:$网址。
它
how about putting a PHP-script to /user/?s=81
, that looks up the user's name in the db and then relocates the user to $url = "/$username";
see PHP's header function passing "Location: $url"
to it.
这篇关于mod_rewrite的PHP的MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!