我用過這個項目。在此處輸入圖像描述這是我的 SQL ( phpmyadmin ):-----------------------------------------------| id | label | link | parent | sort | -----------------------------------------------| 1 | A | a | 0 | 1 || 2 | B | b | 1 | 2 || 3 | C | c | 1 | 3 || 4 | D | d | 0 | 4 || 5 | E | e | 2 | 5 || 6 | F | f | 3 | 6 || 7 | G | g | 0 | 7 |-----------------------------------------------這是我的網址:example.com/index.php?link=aexample.com/index.php?link=a/bexample.com/index.php?link=a/b/eexample.com/index.php?link=a/cexample.com/index.php?link=a/c/fexample.com/index.php?link=dexample.com/index.php?link=gtoexample.com/aexample.com/a/bexample.com/a/b/eexample.com/a/cexample.com/a/c/fexample.com/dexample.com/g.htaccessRewriteEngine OnDirectoryIndex index.phpRewriteCond %{REQUEST_URI} /+[^\.]+$RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]RewriteRule ^([a-zA-Z0-9-/]+)/$ index.php?link=$1這是我的PHP:if(!empty($_GET['link'])){ $url=mysqli_real_escape_string($db,$_GET['link']); $query="SELECT * FROM menu WHERE link='$url'"; $result=mysqli_query($db,$query); while($row=mysqli_fetch_array($result)){ echo $row['id']; } }當我運行http://example.com/d/瀏覽器地址欄中的鏈接時,其輸出如下: 4.但是當我運行鏈接時http://example.com/a/b/e,它的屏幕變白或者輸出不顯示。
添加回答
舉報
0/150
提交
取消