2015-01-09 101 views
0

是否有可能使用PHP从数据库中读取某些内容并将其传输到.htaccess文件中以读取$ url,然后使该文件继续进行.htaccess和添加它的givven的$ url到数据库中...是否有可能通过PHP将.htaccess连接到数据库

+1

什么?你在问路由吗? – kero 2015-01-09 19:36:22

+1

给了我们更多的细节。什么是用户请求的网址?什么是.htaccess结果规则?什么是.htaccess的一个想象中的PHP代码?一般回答你的问题是NO。但也许有另一种解决方案,可以解决您的问题:-) – Alex 2015-01-09 19:37:38

+0

我想从一个PHP文件,从一个数据库自动创建网址的URL ...我想更改网址的url也像view.php url? ID = 1到/ $ title/$ id和view.php?id = 2到/ $ title/$ id我知道如何在htaccess中重写它,但我想从db自动创建url – 2015-01-09 19:41:50

回答

-1

检查@shaddy答案。

这是你应该转移到的方式。

你在想什么:-)。 尝试重新考虑你的应用程序的结构是这样的:

1. user types in browser whatever he wants 

2. htaccess must redirect any uri to your unique script, let say index.php 

3. in that index.php you do whatever YOU want, call database, prepare vars, set conditions, 

and CALL OTHER scripts depending on your conditions. that is an idea of routing :-) 

和谷歌路由PHP的例子“:-)