I've searched through some of the other posts on here with this similar issue, but I haven't managed to make this work. don't know what the problem is.
Home
controller after logon/logout from the Login
controllerI have the error_reporting(E_ALL)
set in my development environment variables and there's no error and tried loading the url helper in my Login
controller: $this->load->helper('url');
Here is the main Home
controller:
public function index() {
if (($this->session->userdata('username') != "")) {
$this->user();
} else {
$this->load->view('login');
}
}
Here's the Login
controller:
public function index()
{
$this->load->view('login');
}
public function logout()
{
$profile = array(
'userid' => '',
'username' => '',
'role' => '',
'custid' => '',
'custname' => '',
'logged_in' => FALSE
);
$this->session->unset_userdata($profile);
$this->session->sess_destroy();
redirect('/', 'refresh');
}
public function logon()
{
$data = $_POST;
$this->db->select("people.*, customers.name as 'custname', customers.id as 'custid'");
$this->db->from('people');
$this->db->join('customers', 'customers.id = people.customer');
$this->db->where('people.username', $data['username']);
$this->db->where('people.password', $data['password']);
$query = $this->db->get();
$results = $query->result_array();
if(count($results) > 0)
{
$profile = array(
'username' => $results[0]['username'],
'userid' => $results[0]['id'],
'role' => $results[0]['role'],
'date_format' => $results[0]['date_format'],
'custname' => $results[0]['custname'],
'custid' => $results[0]['custid'],
'logged_in' => TRUE
);
$this->db->select("*");
$this->db->from('hub.settings');
$this->db->where('customer', $profile['custid']);
$query = $this->db->get();
$results = $query->result_array();
if(count($results) > 0)
{
$profile['contacthtml'] = $results[0]['contacthtml'];
$profile['accentcolor'] = $results[0]['accentcolor'];
}
$this->session->set_userdata($profile);
redirect('/', 'refresh');
}else{
redirect('/login', 'refresh');
}
}
내가 얻는 것은 URL http://localhost:85/login/logon
과 빈 화면뿐입니다.
나는 또한 시도했다 : redirect('/home', 'refresh');
, redirect('/home');
, redirect('home', 'refresh');
, redirect('home/', 'refresh');
,redirect('/home/', 'refresh');
편집하다:
이것은 개발 도구의 네트워크 섹션의 응답입니다.
주석에서 언급했듯이 구성 파일의 base_url은 후행 슬래시로 설정해야합니다. 귀하의 경우 :
$config['base_url'] = 'http://localhost:85/';
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다