thinkphp3.2----实现伪静态和路由配置
Posted 东方素
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了thinkphp3.2----实现伪静态和路由配置相关的知识,希望对你有一定的参考价值。
URL模式:
0.普通 http://localhost/qixin/ThinkCMF(test)_backup/index.php?g=user&m=login&a=index 带有?号这种传参路径,对SEO不友好
1.pathinfo http://localhost/qixin/ThinkCMF(test)_backup/index.php/user/login/index
2.rewrite http://localhost/qixin/ThinkCMF(test)_backup/user/login/index.html 已经去除掉index.php,要开启Apache rewrite moudle,建立.htaccess文件
在config中配置
‘URL_ROUTER_ON‘ => true, // 开启路由 ‘URL_MODEL‘=>2, //URL模式 ‘URL_ROUTE_RULES‘=>array( //‘路由表达式‘ => ‘路由地址和传入参数‘ ‘product‘=>‘Index/Index/product‘, ‘articleList‘=>‘Index/Article/articleList‘, ‘/^articleList_cat_id_(\d+)$/‘=>‘Index/Article/articleList?cat_id=:1‘, ‘/^article_id_(\d+)$/‘=>‘Index/Article/detail?article_id=:1‘,
‘upload_face$‘ => ‘user/profile/upload_face‘, //规则路由 http://localhost/qixin/ThinkCMF(test)_backup/upload_face.html
‘/^upload_face_(\d+)$/‘ => ‘user/profile/upload_face‘ //正则路由 http://localhost/qixin/ThinkCMF(test)_backup/upload_face_1.html ), ‘URL_HTML_SUFFIX‘ => ‘html‘, // URL伪静态后缀设置
以上是关于thinkphp3.2----实现伪静态和路由配置的主要内容,如果未能解决你的问题,请参考以下文章