Welcome Guest, Not a member yet? Register   Sign In
get_instance function
#8

(12-23-2020, 10:06 PM)InsiteFX Wrote: For session in file.

PHP Code:
<?= session('item'); ?>

It is also chainable.

PHP Code:
<?php

$session 
session();

$tmp session()->item;
$tmp session()->get('item');

?>

Very easy with CodeIgniter 4.


In this case is session() a function that does not exist. Don't I have to load the session driver first? With Codeigniter 3 it was done this way
Code:
$CI =& get_instance();
$CI->load->driver('session');

How should that be done with CodeIgniter 4?
Reply


Messages In This Thread
get_instance function - by superior - 10-16-2016, 06:12 AM
RE: get_instance function - by sv3tli0 - 10-16-2016, 08:31 AM
RE: get_instance function - by superior - 10-17-2016, 01:06 AM
RE: get_instance function - by webdevron - 08-15-2019, 06:47 AM
RE: get_instance function - by dave friend - 08-15-2019, 10:02 AM
RE: get_instance function - by DzS1 - 12-23-2020, 07:38 AM
RE: get_instance function - by InsiteFX - 12-23-2020, 10:06 PM
RE: get_instance function - by DzS1 - 12-24-2020, 02:56 AM
RE: get_instance function - by InsiteFX - 12-24-2020, 01:16 PM
RE: get_instance function - by DzS1 - 12-26-2020, 03:50 AM
RE: get_instance function - by InsiteFX - 12-26-2020, 12:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB