此页面无法正常工作,目前无法处理此请求。 Codeigniter 应用程序中的 HTTP 错误 500
This page isn’t working is currently unable to handle this request. HTTP ERROR 500 in Codeigniter App
这是我的控制器功能,点击登录后网站应该重定向到
我的网站.com/user/profile
这个 profile() 方法是,
public function profile(){
$this->user = $this->session->userdata("user");
if(empty($this->user)){
redirect('login');
exit;
}
$data["user"] = $this->crud->get_user($this->user["ID"]);
$data["form_error"] = $this->session->flashdata('form_error');
$data["csrf"] = array(
'name' => $this->security->get_csrf_token_name(),
'hash' => $this->security->get_csrf_hash()
);
$this->load->view('user/profile', $data);
//$this->load->view('user/profile-static', $data);
}
这是重定向到 user/profile 方法的控制器代码
class Login extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->library('email');
$this->load->library('form_validation');
if(!empty($this->session->userdata("user"))){
redirect('user/profile');
//redirect('user/profile-static');
exit;
}
}
但是页面上说
这个页面不工作
mysite.com 目前无法处理此请求。
HTTP 错误 500
请帮忙。 TIA
.htaccess 文件需要以下代码。
RewriteRule ^(.*)$ index.php/ [PT,L]
感谢大家的建议。我找到了解决方法。这是数据库错误。
我从数据库调用数据的模型函数在这里
public function get_user($id=""){
$this->db->select("*");
$this->db->where(array("ID" => $id));
$query = $this->db->get("users");
return $query->row_array();
}
这是我的控制器功能,点击登录后网站应该重定向到 我的网站.com/user/profile
这个 profile() 方法是,
public function profile(){
$this->user = $this->session->userdata("user");
if(empty($this->user)){
redirect('login');
exit;
}
$data["user"] = $this->crud->get_user($this->user["ID"]);
$data["form_error"] = $this->session->flashdata('form_error');
$data["csrf"] = array(
'name' => $this->security->get_csrf_token_name(),
'hash' => $this->security->get_csrf_hash()
);
$this->load->view('user/profile', $data);
//$this->load->view('user/profile-static', $data);
}
这是重定向到 user/profile 方法的控制器代码
class Login extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->library('email');
$this->load->library('form_validation');
if(!empty($this->session->userdata("user"))){
redirect('user/profile');
//redirect('user/profile-static');
exit;
}
}
但是页面上说 这个页面不工作 mysite.com 目前无法处理此请求。 HTTP 错误 500 请帮忙。 TIA
.htaccess 文件需要以下代码。
RewriteRule ^(.*)$ index.php/ [PT,L]
感谢大家的建议。我找到了解决方法。这是数据库错误。
我从数据库调用数据的模型函数在这里
public function get_user($id=""){
$this->db->select("*");
$this->db->where(array("ID" => $id));
$query = $this->db->get("users");
return $query->row_array();
}