thinkPHP四种URL访问方式(二)
2015-06-23 08:48
507 查看
原文:
thinkPHP四种URL访问方式(二)
四、url的4种访问方式
1.PATHINFO 模式 -- (重点)
http://域名/项目名/入口文件/模块名/方法名/键1/值1/键2/值2 http://localhost/thinkphp/index.php/Index/index http://localhost/thinkphp/index.php/Index/add/name/leyangjun ---传参(也支持通用的模式?name=leyangjun)
2.普通模式
http://域名/项目名/入口文件?m=模块名&a=方法名&键1=值1&键2=值2 http://localhost/thinkphp/index.php?m=Index&a=index&name=leyangjun
3.REWRITE模式(比如不想看见index.php)
一:要开启Apache模块 :LoadModule rewrite_module modules/mod_rewrite.so --去掉#号
二:在入口文件出写.htaccess在该文件中写入重写规则,文件已在分享中
http://域名/项目名/模块名/方法名/键1/值1/键2/值2 http://localhost/thinkphp/Index/index
4.兼容模式
http://域名/项目名/入口文件?s=模块名/方法名/键1/值1/键2/值2 http://localhost/thinkphp/index.php?s=Index/index
thinkPHP四种URL访问方式(二)
四、url的4种访问方式
1.PATHINFO 模式 -- (重点)
http://域名/项目名/入口文件/模块名/方法名/键1/值1/键2/值2 http://localhost/thinkphp/index.php/Index/index http://localhost/thinkphp/index.php/Index/add/name/leyangjun ---传参(也支持通用的模式?name=leyangjun)
2.普通模式
http://域名/项目名/入口文件?m=模块名&a=方法名&键1=值1&键2=值2 http://localhost/thinkphp/index.php?m=Index&a=index&name=leyangjun
3.REWRITE模式(比如不想看见index.php)
一:要开启Apache模块 :LoadModule rewrite_module modules/mod_rewrite.so --去掉#号
二:在入口文件出写.htaccess在该文件中写入重写规则,文件已在分享中
http://域名/项目名/模块名/方法名/键1/值1/键2/值2 http://localhost/thinkphp/Index/index
4.兼容模式
http://域名/项目名/入口文件?s=模块名/方法名/键1/值1/键2/值2 http://localhost/thinkphp/index.php?s=Index/index
相关文章推荐
- thinkPHP框架介绍(一)
- matplotlib简单的新手教程和动画
- php中利用header设置content-type和常见文件类型的content-type
- PHP的UTF-8中文转拼音处理类
- PHP中文转拼音函数
- php用301永久性重定向域名
- PHP扩展开发之文件存储
- 重装系统后phpStudy如何启动
- yii url美化 urlManager组件
- PHP实现链式操作的核心思想
- PHP中通过trigger_error触发PHP错误示例
- PHP中把错误日志保存在系统日志中(Windows系统)
- PHP配置把错误日志以邮件方式发送方法(Windows系统)
- PHP register_shutdown_function()函数的使用示例
- php中header设置常见文件类型的content-type
- PHP实现在线阅读PDF文件的方法
- Js+php实现异步拖拽上传文件
- vsftpd
- 源码编译安装PHP7
- php 注册登录,邮件确认激活