【发布时间】:2010-11-08 17:51:02
【问题描述】:
我正在尝试为我的网站创建用户配置文件,其中 URL 类似于
mysite.com/user/ChrisSalij
目前我的控制器是这样的:
<?php
class User extends Controller {
function user(){
parent::Controller();
}
function index(){
$data['username'] = $this->uri->segment(2);
if($data['username'] == FALSE) {
/*load default profile page*/
} else {
/*access the database and get info for $data['username']*/
/*Load profile page with said info*/
}//End of Else
}//End of function
}//End of Class
?>
目前我每次去都会收到 404 错误;
mysite.com/user/ChrisSalij
我认为这是因为它期望有一个名为 ChrisSalij 的方法。
虽然我确定我也在滥用$this->uri->segment(); 命令
任何帮助将不胜感激。 谢谢
【问题讨论】:
标签: php codeigniter user-profile