• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
session in view file

#2
(10-12-2019, 01:32 AM)jbloch Wrote: How to get session value in view file In CI4?
Something like this:
PHP Code:
// IN CONTROLLER:
<?php
namespace App\Controller;

use 
CodeIgniter\Controller;

class 
My_Controller extends Controller
{
     private 
$session null;
     public function myMethod() {
          
$this->session session();
          
$data['get_sess'] = $this->session->get('item');
          echo view('folder/template'$data['get_session'])
     }
}
// IN VIEWS:
<?= $get_session?>

Session documentation: Link
I would change this world, but God doesn't give me the source.
Reply


Messages In This Thread
session in view file - by jbloch - 10-12-2019, 01:32 AM
RE: session in view file - by Digital_Wolf - 10-12-2019, 08:03 AM
RE: session in view file - by Ekley - 10-13-2019, 02:58 AM
RE: session in view file - by InsiteFX - 10-13-2019, 08:07 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.