in codeigniter 4 as per the documentation we have to load library as
$session = \Config\Services::session();
if i write it on above of controller name
<?php
namespace App\Controllers;
$session = \Config\Services::session();
class Home extends BaseController
{
}
i cant access $session variable in any function, even if i wrote it in __construct it is not accessible in any function if i write it any function then only it is working, but i wants to set it globally.