Welcome Guest, Not a member yet? Register   Sign In
Problem with CI4 session
#1

(This post was last modified: 12-15-2019, 12:25 AM by webdevron.)

Do not know why, the session in the constructor is not working but in other method. Help me to find this out. Thanks in advance.

PHP Code:
<?php

namespace App\Controllers;

class 
Manage extends BaseController
{

 protected 
$session;

 public function 
__construct(){
     
$this->session = \Config\Services::session();
     if( !
$this->session->has('isCnProL') ) return redirect()->to(base_url('login')); // Not working
 
}

 public function 
new_post()
 {
     if( !
$this->session->has('isCnProL') ) return redirect()->to(base_url('login')); // Working
     
$this->manageView('post-new');
 } 
"Who thinks in code"
Perfectly describes who I am
mbparvez.me
Reply


Messages In This Thread
Problem with CI4 session - by webdevron - 12-15-2019, 12:25 AM
RE: Problem with CI4 session - by InsiteFX - 12-15-2019, 05:38 AM
RE: Problem with CI4 session - by webdevron - 12-15-2019, 02:00 PM
RE: Problem with CI4 session - by InsiteFX - 12-16-2019, 06:20 AM
RE: Problem with CI4 session - by InsiteFX - 12-16-2019, 09:17 AM
RE: Problem with CI4 session - by asepma - 04-24-2020, 04:19 AM
RE: Problem with CI4 session - by InsiteFX - 04-24-2020, 08:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB