Welcome Guest, Not a member yet? Register   Sign In
Initializing a Session
#1

(This post was last modified: 05-17-2020, 01:54 PM by jreklund.)

I'm new to CI and a lot of things involved with it. I'm trying to get a Login Form example working in CI4. I suspect the code is for a previous CI version.

I've read the CI User Guide pages on the Session Library  however am not clear where the code to initialize the session goes. I looked to put it in the autoload.php file as in the example code, however that file looks completely different to the one I have in my AppStarter-initialized app so no idea where to insert it there.

Then I've read that the code should be put in the Controller constructor which gave me errors. Then I read somewhere else that it should be put in a constructor of a class that extends BaseController not Controller. I've only just started using CI and the tutorial Controller classes extended the Controller class so I'm not really sure of the differences between the two.

Anyhow, despite this I tried putting it in the constructor of a Controller that extended BaseController but got the following:

Code:
ErrorException

Declaration of App\Controllers\Login::initController() should be compatible with CodeIgniter\Controller::initController(CodeIgniter\HTTP\RequestInterface $request, CodeIgniter\HTTP\ResponseInterface $response, Psr\Log\LoggerInterface $logger)

Grateful for any help or advice on any of this - thanks!
Reply


Messages In This Thread
Initializing a Session - by jim1001 - 05-17-2020, 11:57 AM
RE: Initializing a Session - by jreklund - 05-17-2020, 01:59 PM
RE: Initializing a Session - by jim1001 - 05-19-2020, 07:10 AM
RE: Initializing a Session - by dave friend - 05-19-2020, 08:12 AM
RE: Initializing a Session - by jim1001 - 05-19-2020, 11:04 AM
RE: Initializing a Session - by dave friend - 05-19-2020, 02:29 PM
RE: Initializing a Session - by jim1001 - 05-20-2020, 01:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB