default data passed through BaseController |
Hi there...
I'm trying to do my first project with CodeIgniter 4. I want to pass standard data to View set inside the BaseController. But following code does not work: Controller (BaseController) PHP Code: public $data = [ PHP Code: public function index() I want to have default variables which I can change in the controller. Any Ideas ? Thanks, Kigh... Now it works fine, but I get an error with preloading "session": Quote:Fatal error: Uncaught ErrorException: touch(): Unable to create file NULL/ci_session7roacrtom0dsiftqc3pdd0j1jnjv6ejo because No such file or directory in C:\xampp\htdocs\kighlander.local\system\Session\Handlers\FileHandler.php:252 Stack trace: #0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'touch(): Unable...', 'C:\\xampp\\htdocs...', 252, Array) #1 C:\xampp\htdocs\kighlander.local\system\Session\Handlers\FileHandler.php(252): touch('NULL/ci_session...') #2 [internal function]: CodeIgniter\Session\Handlers\FileHandler->write('7roacrtom0dsift...', '__ci_last_regen...') #3 [internal function]: session_write_close() #4 {main} thrown in C:\xampp\htdocs\kighlander.local\system\Session\Handlers\FileHandler.php on line 252
Your getting the session error because the variable session is missing in the BaseController.
Here is Mine. PHP Code: <?php What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |