如何更改 URL 在页面上调用的功能?下面是一个示例:https://exaplesitename.com/index.php?id=21 它现在的样子,但我希望它是这样的:https://exaplesitename.com/Entertainment 这是导航代码:<?phpfunction find_parent_categories($options=[]) { global $db; $Active = $options['Active'] ?? 'false'; $sql = "SELECT * FROM Parent_Categories "; if($Active){ $sql .= "WHERE Active = true "; } $sql .= "ORDER BY Category_Order ASC"; $result = mysqli_query($db, $sql); confirm_result_set($result); return $result;}function find_categories($id_Category_Parent, $options=[]){ global $db; $Active = $options['Active'] ?? 'false'; $sql = "SELECT * FROM Categories "; $sql .= "WHERE id_Category_Parent='" . db_escape($db, $id_Category_Parent) . "' "; if($Active){ $sql .= "AND Active = true "; } $sql .= "ORDER BY Category_Order ASC"; $result = mysqli_query($db, $sql); confirm_result_set($result); return $result;} ?><nav class="navbar fixed-top navbar-expand-lg bg-white navbar-custom"> <a class="navbar-brand" href="<?php echo url_for('/index.php'); ?>"> <img src="../../images/Logo1.png" alt="Nantucket" class="img-fixed"/> </a> <button class="navbar-toggler custom-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent1" aria-controls="navbarSupportedContent1" aria-expanded="false" aria-label="Toggle navigation">Menu <span class="navbar-toggler-icon"></span> </button>
1 回答
泛舟湖上清波郎朗
TA贡献1818条经验 获得超3个赞
网址中的任何更改都可以通过更改 .htaccess 文件来实现。
RewriteEngine On RewriteRule https://exaplesitename.com/Entertainment https://exaplesitename.com/index.php?id=21
有关 .htaccess 的更多信息,请参阅:
https://www.smashingmagazine.com/2011/11/introduction-to-url-rewriting/
- 1 回答
- 0 关注
- 98 浏览
添加回答
举报
0/150
提交
取消