How to Implement URL Routing with PHP + IIS?(如何用PHP+IIS实现URL路由?)
问题描述
我编写了一个内容切换器脚本,该脚本使用动态 URL 来传递指示要发送哪些数据的参数.
I wrote a content switcher script that uses dynamic URLs to pass parameters indicating what data is to be sent.
例如要查看关于页面,您可以输入:http://www.example.com/?page=about
For example to view the about page you would type: http://www.example.com/?page=about
问题是这对用户不友好,尤其是在我的情况下,用户不一定通过主页上的链接访问此页面.
The issue is that this is not user friendly especially in my case where users will not necessarily be accessing this page via a link from the home page.
我希望 URL 看起来像:http://www.example.com/about/
What I would rather have the URL look like is: http://www.example.com/about/
不幸的是,我在 IIS 平台上运行 PHP5,而不是 Apache,因此这消除了使用 mod-rewrite 的最常见方法.
Unfortunately I am running PHP5 on an IIS platform, not Apache, so this eliminates the most common methods that use mod-rewrite.
我正在寻找有关如何使用 PHP + IIS 进行 URL 路由的示例.
I'm looking for examples of how to do URL Routing with PHP + IIS.
在IIS 7.5平台上可以吗?
Can it be done on the IIS 7.5 platform?
推荐答案
由于您使用的是 IIS 7,因此您可以使用现在可用的新重写支持.
Since you're using IIS 7, you can use the new rewriting support that's now available.
看看http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module
这篇关于如何用PHP+IIS实现URL路由?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何用PHP+IIS实现URL路由?


基础教程推荐
- HTTP 与 FTP 上传 2021-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- PHP 守护进程/worker 环境 2022-01-01
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- 使用 PDO 转义列名 2021-01-01