您的位置:首页 > 编程语言 > PHP开发

笔记--ThinkPHP的URL模式

2016-08-23 12:56 239 查看
<?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_MODEL
return array(
//'配置项'=>'配置值'
'name'=>'Tim',
'URL_MODEL'=>0,
);
1.默认模式 1 (pathinfo 模式 1) http://localhost/test313/index.php/Index/user/id/1.html 2.普通模式 0 http://localhost/test313/index.php?m=Index&a=user&id=1 3.重写模式 2 http://localhost/test313/Index/user/id/1.html 4.兼容模式 3 (不知道web服务器时候使用兼容模式可以运行起来) http://localhost/test313/index.php?s=/Index/user/id/1.html */
}

1.注意U方法的用法

2.注意URL_MODEL的设置。

3.注意各种方法的区别。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: