php - PHP 变化?从网址到 /
问题描述
我想更改 PHP http://localhost/dispatch.php?category=lupa&id=1(或任何整数)中的链接我在互联网上发现了很多 htacces 但它不是动态的。我有 10-20 页和 1-5 个参数/链接。在互联网上,只有 index.php 的 htacces 和 1 个参数。我想要一个动态的 htacces,应用于所有页面和所有参数,比如 laravel 路由。
解决方案
你可以这样写:
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$ /dispatch.php?category=$1&id=$2 [L]
推荐阅读
- android - 如何将 Google Play 发布前报告与 expo / react-native 结合使用
- php - 如何从codeigniter活动记录中获取result_array列表到row_array
- python - 如何将文件路径中的部分目录名称附加到 bash 或 python 中的文件名称?
- python - 将简单类序列化为文件中的一行
- android - 签名的 APK 不起作用,但调试版本工作正常
- swift - 将 Json 字符串解码为类对象 Swift
- vue.js - Vue.js 更改数据和重新渲染时间?
- sqlite - 在这种情况下如何执行子查询?
- python - 嵌套字典到数据框,将字典键保留为列而不是索引
- node.js - 带有faker的工厂女孩在节点快递中生成相同的数据