亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用 .htaccess 和 php 的 url 子目錄

使用 .htaccess 和 php 的 url 子目錄

PHP
慕村225694 2022-12-23 15:27:25
我用過這個項目。在此處輸入圖像描述這是我的 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,它的屏幕變白或者輸出不顯示。
查看完整描述

1 回答

?
一只萌萌小番薯

TA貢獻1795條經驗 獲得超7個贊

您正在將其重寫為index.php?link=a/b/e



查看完整回答
反對 回復 2022-12-23
  • 1 回答
  • 0 關注
  • 87 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號