![](/img/trans.png)
[英]How do I rewrite the URL for example.com/index.php#anchor to example.com/anchor?
[英]How do you write a web script to deal with urls of the form example.com/data/234 rather than example.com/data.php?id=234?
我$_GET
在PHP脚本中使用$_POST
和$_GET
数组。 我正在尝试学习Backbone(特别是Backbone.sync函数),显然它假定您将设置服务器,以便example.com/student/32053检索ID为32053的学生。
在Apache服务器上,使用mod_rewrite模块。 在您的.htaccess
文件中,只需指定一个简单的规则,例如:
^data/(\d+)$ data.php?id=$1 [L]
这样做时,在调用example.com/data/100
,apache将在内部调用example.com/data.php?id=100
。
让我知道您是否需要类似的Microsoft IIS示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.