我用过这个项目。在此处输入图像描述这是我的 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
提交
取消