我遇到了一些奇怪的错误(CodeIgniter):
调用未定义的函数视图()。
但是我使用login作为默认控制器。 index()正在加载页面,而加载函数中的视图不起作用。
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Login extends CI_Controller{
public function index(){
$this->load->view('login_view');
}
public function processLogin(){
if(isset($_POST['username']) && isset($_POST['password'])){
if(!empty($_POST['username']) && !empty($_POST['password'])){
$this->load->model("user");
$suc = $this->user->login($_POST['username'],$_POST['password']);
if($suc !=0 && $suc !=-1){
}
else{
if($suc == 0){
$data['error'] = "Invalid credentials";
$this->load>view('login_view',$data);
}
else{
$data['error'] = "Multiple user exist with same logon";
$this->load>view('login_view',$data);
}
}
}
}
}
}
?>
答案 0 :(得分:0)
您错过了-
附近的>
改变这个:
if($suc == 0){
$data['error'] = "Invalid credentials";
$this->load>view('login_view',$data);
}
else{
$data['error'] = "Multiple user exist with same logon";
$this->load>view('login_view',$data);
}
到此:
if($suc == 0){
$data['error'] = "Invalid credentials";
$this->load->view('login_view',$data);
}
else{
$data['error'] = "Multiple user exist with same logon";
$this->load->view('login_view',$data);
}
我更改了两行:$this->load>view
到此:$this->load->view