2015-01-09 103 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的例子「:-)