SoFunction
Updated on 2025-03-01

CodeIgniter How to delete and set cookies

This article describes the method of CodeIgniter deleting and setting cookies. Share it for your reference. The details are as follows:

$cookie = array(
  'name'  => 'loggedin',
  'value' => 'yes',
  'expire' => '86500',
  'domain' => '.',
  'prefix' => 'apollidon_'
  );
set_cookie($cookie);
$cookie = array(
  'name'  => 'loggedin',
  'value' => '',
  'expire' => '0',
  'domain' => '.',
  'prefix' => 'apollidon_'
  );
delete_cookie($cookie);

I hope that this article will be helpful to everyone's php programming based on the CodeIgniter framework.