Php 重定向到另一页时出现Codeigniter内部服务器错误
我有以下功能,可以重定向到另一个关于成功的页面:Php 重定向到另一页时出现Codeigniter内部服务器错误,php,.htaccess,codeigniter,redirect,Php,.htaccess,Codeigniter,Redirect,我有以下功能,可以重定向到另一个关于成功的页面: public function process() { $username = $this->input->post('username'); $password = $this->input->post('password'); // Validate the user can login $result = $this->login_model
public function process() {
$username = $this->input->post('username');
$password = $this->input->post('password');
// Validate the user can login
$result = $this->login_model->validate($username, $password);
// Now we verify the result
if (!$result) {
if (empty($password)) {
$msg = '<font color=red>Invalid username and/or password.</font><br />';
$this->index($msg);
} else {
$msg = '<font color=red>Invalid username and/or password.</font><br />';
$this->index($msg);
}
} else {
// If user did validate,
// Send them to members area
redirect('home');
}
}
有没有其他方法可以在codeigniter中执行重定向而不使用php重定向函数
确保索引函数接受传入参数
在控制器中
public function process() {
$username = $this->input->post('username');
$password = $this->input->post('password');
$result = $this->login_model->validate($username, $password);
if (isset($result)) { #change this
if (empty($password)) {
$msg = '<font color=red>Invalid username and/or password.</font><br />';
$this->index($msg); # not sure about this
}
else {
$msg = '<font color=red>Invalid username and/or password.</font><br />';
$this->index($msg); # not sure about this
}
}
else {
redirect('home');
}
}
公共职能流程(){
$username=$this->input->post('username');
$password=$this->input->post('password');
$result=$this->login\u model->validate($username,$password);
如果(isset($result)){#更改此项
if(空($password)){
$msg='无效的用户名和/或密码。
';
$this->index($msg)#对此不确定
}
否则{
$msg='无效的用户名和/或密码。
';
$this->index($msg)#对此不确定
}
}
否则{
重定向(“主页”);
}
}
确保索引函数接受传入参数
在控制器中
public function process() {
$username = $this->input->post('username');
$password = $this->input->post('password');
$result = $this->login_model->validate($username, $password);
if (isset($result)) { #change this
if (empty($password)) {
$msg = '<font color=red>Invalid username and/or password.</font><br />';
$this->index($msg); # not sure about this
}
else {
$msg = '<font color=red>Invalid username and/or password.</font><br />';
$this->index($msg); # not sure about this
}
}
else {
redirect('home');
}
}
公共职能流程(){
$username=$this->input->post('username');
$password=$this->input->post('password');
$result=$this->login\u model->validate($username,$password);
如果(isset($result)){#更改此项
if(空($password)){
$msg='无效的用户名和/或密码。
';
$this->index($msg)#对此不确定
}
否则{
$msg='无效的用户名和/或密码。
';
$this->index($msg)#对此不确定
}
}
否则{
重定向(“主页”);
}
}
是否检查了htaccess文件?是否检查了htaccess文件?