6.URL说明
LMLPHP支持PATH_INFO,参数模式,普通模式三种URL模式,优先级从前到后。三种方式都分别拥有各自的rewrite模式。下面对这三种方式逐一进行分解:

PATH_INFO模式 (LMLPHP在PATH_INFO不存在时,通过SCRIPT_URI获取PATH_INFO,因此在服务器不提供PATH_INFO时也可使用)
URLModuleAction
http://www.domain.com/index.php/ModuleIndexindex
http://www.domain.com/index.php/ArticleModuleArticleindex
http://www.domain.com/index.php/Article/newestModuleArticlenewest
对应rewrite模式如下:
http://www.domain.com/ModuleIndexindex
http://www.domain.com/ArticleModuleArticleindex
http://www.domain.com/Article/newestModuleArticlenewest

参数模式 (LMLPHP默认的rewrite规则只去除入口文件,如果更改rewrite规则可以达到和PATH_INFO一样的效果)
URLModuleAction
http://www.domain.com/index.php?path=/ModuleIndexindex
http://www.domain.com/index.php?path=/ArticleModuleArticleindex
http://www.domain.com/index.php?path=/Article/newestModuleArticlenewest
对应rewrite模式如下:
http://www.domain.com/?path=/ModuleIndexindex
http://www.domain.com/?path=/ArticleModuleArticleindex
http://www.domain.com/?path=/Article/newestModuleArticlenewest

普通模式
URLModuleAction
http://www.domain.com/index.phpModuleIndexindex
http://www.domain.com/index.php?m=ArticleModuleArticleindex
http://www.domain.com/index.php?m=Article&a=newestModuleArticlenewest
对应rewrite模式如下:
http://www.domain.com/ModuleIndexindex
http://www.domain.com/?m=ArticleModuleArticleindex
http://www.domain.com/?m=Article&a=newestModuleArticlenewest
« 5.模板赋值7.错误处理 »
© 2025 LMLPHP 关于我们 联系我们 友情链接 耗时0.001696(s)
2025-09-03 16:03:35 1756886615