笔记--ThinkPHP的URL模式

来源:互联网 发布:instagram类似社交软件 编辑:程序博客网 时间:2024/05/18 01:12
<?php// 本类由系统自动生成,仅供测试用途class IndexAction extends Action {    public function index(){//echo 'hello, world!';//echo C('URL_MODEL');//U方法(1.模块名,2数组array("id"=>1),3.后缀名“html shtml”,4.是否跳转(true/false)5.localhost)echo U('Index/user',array('id'=>1),'html',false,'localhost');    }public function user(){echo 'id is:'.$_GET['id'].'<br/>';echo '这里是INDEX 模块的user方法';}/*URL_MODELreturn array(//'配置项'=>'配置值''name'=>'Tim','URL_MODEL'=>0,);1.默认模式 1 (pathinfo 模式 1)http://localhost/test313/index.php/Index/user/id/1.html2.普通模式 0http://localhost/test313/index.php?m=Index&a=user&id=13.重写模式 2http://localhost/test313/Index/user/id/1.html4.兼容模式 3 (不知道web服务器时候使用兼容模式可以运行起来)http://localhost/test313/index.php?s=/Index/user/id/1.html*/}

1.注意U方法的用法

2.注意URL_MODEL的设置。

3.注意各种方法的区别。

0 0