• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
set_cookie() doesn't work with redirect()

#1
Hello,
This is my code:

PHP Code:
namespace App\Controllers;
use 
CodeIgniter\Controller;

class 
Home extends Controller
{
    public function 
__construct()
 
 {
 
   helper(['cookie']);
 
 }
    public function 
page1()
    {
        
set_cookie('test''testvalue-'.time(), time() + 86400);
        return 
redirect()->to('page2');
    }
    public function 
page2()
    {
        echo 
get_cookie('test');
    }


Redirect is working but there is no 'test' cookie on page2. Please help.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
2 Guest(s)


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