• Selamat datang di CodeIgniter
  • Panduan Instalasi
    • Downloading CodeIgniter
    • Panduan Instalasi
    • Upgrade Dari Versi Sebelumnya
    • Penyelesaian Masalah
  • Ikhtisar CodeIgniter
    • Memulai dengan CodeIgniter
    • Sekilas Tentang CodeIgniter
    • Fitur yang Didukung
    • Alur Aplikasi
    • Model-View-Controller
    • Desain and Sasaran Arsitektur
  • Tutorial
    • Halaman Statis
    • Bagian Berita
    • Membuat Item Berita
    • Kesimpulan
  • Berkontribusi ke CodeIgniter
    • Menulis Dokumentasi CodeIgniter
    • Developer’s Certificate of Origin 1.1
  • Pembahasan Umum
    • CodeIgniter URLs
    • Controllers
    • Reserved Names
    • Views
    • Model
    • Helpers
    • Menggunakan Library CodeIgniter
    • Membuat Library
    • Using CodeIgniter Drivers
    • Membuat Driver
    • Membuat Class Inti Sistem
    • Membuat Class Tambahan
    • Hooks - Mengembangkan Inti Framework
    • Auto-loading Resources
    • Fungsi-fungsi Umum
    • Fungsi-fungsi Kompatibilitas
    • URI Routing
    • Penanganan Error
    • Caching
    • Profiling Aplikasi Anda
    • Menjalankan dengan CLI
    • Mengelola Aplikasi Anda
    • Handling Multiple Environments
    • Alternatif Syntax PHP untuk File View
    • Keamanan
    • PHP Style Guide
  • Referensi Library
    • Benchmarking Class
    • Caching Driver
    • Calendaring Class
    • Shopping Cart Class
    • Config Class
    • Email Class
    • Encrypt Class
    • Encryption Library
    • File Uploading Class
    • Form Validation
    • FTP Class
    • Image Manipulation Class
    • Input Class
    • Javascript Class
    • Language Class
    • Loader Class
    • Migrations Class
    • Output Class
    • Pagination Class
    • Template Parser Class
    • Security Class
    • Session Library
    • HTML Table Class
    • Trackback Class
    • Typography Class
    • Unit Testing Class
    • URI Class
    • User Agent Class
    • XML-RPC and XML-RPC Server Classes
    • Zip Encoding Class
  • Referensi Database
    • Quick Start: Contoh Penggunaan
    • Konfigurasi Database
    • Menghubungkan ke Database
    • Menjalankan Queries
    • Menampilkan Hasil Query
    • Fungsi-fungsi Query Helper
    • Query Builder Class
    • Transactions
    • Mendapatkan MetaData
    • Memanggil Custom Functions
    • Query Caching
    • Manipulasi Database dengan Database Forge
    • Database Utilities Class
    • Referensi Database Driver
  • Referensi Helper
    • Array Helper
    • CAPTCHA Helper
    • Cookie Helper
    • Date Helper
    • Directory Helper
    • Download Helper
    • Email Helper
    • File Helper
    • Form Helper
    • HTML Helper
    • Inflector Helper
    • Language Helper
    • Number Helper
    • Path Helper
    • Security Helper
    • Smiley Helper
    • String Helper
    • Text Helper
    • Typography Helper
    • URL Helper
    • XML Helper
Toggle Table of Contents
CodeIgniter
  • Selamat datang di CodeIgniter
  • Panduan Instalasi
    • Downloading CodeIgniter
    • Panduan Instalasi
    • Upgrade Dari Versi Sebelumnya
    • Penyelesaian Masalah
  • Ikhtisar CodeIgniter
    • Memulai dengan CodeIgniter
    • Sekilas Tentang CodeIgniter
    • Fitur yang Didukung
    • Alur Aplikasi
    • Model-View-Controller
    • Desain and Sasaran Arsitektur
  • Tutorial
    • Halaman Statis
    • Bagian Berita
    • Membuat Item Berita
    • Kesimpulan
  • Berkontribusi ke CodeIgniter
    • Menulis Dokumentasi CodeIgniter
    • Developer’s Certificate of Origin 1.1
  • Pembahasan Umum
    • CodeIgniter URLs
    • Controllers
    • Reserved Names
    • Views
    • Model
    • Helpers
    • Menggunakan Library CodeIgniter
    • Membuat Library
    • Using CodeIgniter Drivers
    • Membuat Driver
    • Membuat Class Inti Sistem
    • Membuat Class Tambahan
    • Hooks - Mengembangkan Inti Framework
    • Auto-loading Resources
    • Fungsi-fungsi Umum
    • Fungsi-fungsi Kompatibilitas
    • URI Routing
    • Penanganan Error
    • Caching
    • Profiling Aplikasi Anda
    • Menjalankan dengan CLI
    • Mengelola Aplikasi Anda
    • Handling Multiple Environments
    • Alternatif Syntax PHP untuk File View
    • Keamanan
    • PHP Style Guide
  • Referensi Library
    • Benchmarking Class
    • Caching Driver
    • Calendaring Class
    • Shopping Cart Class
    • Config Class
    • Email Class
    • Encrypt Class
    • Encryption Library
    • File Uploading Class
    • Form Validation
    • FTP Class
    • Image Manipulation Class
    • Input Class
    • Javascript Class
    • Language Class
    • Loader Class
    • Migrations Class
    • Output Class
    • Pagination Class
    • Template Parser Class
    • Security Class
    • Session Library
    • HTML Table Class
    • Trackback Class
    • Typography Class
    • Unit Testing Class
    • URI Class
    • User Agent Class
    • XML-RPC and XML-RPC Server Classes
    • Zip Encoding Class
  • Referensi Database
    • Quick Start: Contoh Penggunaan
    • Konfigurasi Database
    • Menghubungkan ke Database
    • Menjalankan Queries
    • Menampilkan Hasil Query
    • Fungsi-fungsi Query Helper
    • Query Builder Class
    • Transactions
    • Mendapatkan MetaData
    • Memanggil Custom Functions
    • Query Caching
    • Manipulasi Database dengan Database Forge
    • Database Utilities Class
    • Referensi Database Driver
  • Referensi Helper
    • Array Helper
    • CAPTCHA Helper
    • Cookie Helper
    • Date Helper
    • Directory Helper
    • Download Helper
    • Email Helper
    • File Helper
    • Form Helper
    • HTML Helper
    • Inflector Helper
    • Language Helper
    • Number Helper
    • Path Helper
    • Security Helper
    • Smiley Helper
    • String Helper
    • Text Helper
    • Typography Helper
    • URL Helper
    • XML Helper
 
CodeIgniter
  • Docs »
  • Referensi Helper »
  • Cookie Helper
  • classic layout

Cookie Helper¶

The Cookie Helper file contains functions that assist in working with cookies.

  • Loading this Helper
  • Available Functions

Loading this Helper¶

This helper is loaded using the following code:

$this->load->helper('cookie');

Available Functions¶

The following functions are available:

set_cookie($name[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = FALSE[, $httponly = FALSE]]]]]]]])¶
Parameter:
  • $name (mixed) – Cookie name or associative array of all of the parameters available to this function
  • $value (string) – Cookie value
  • $expire (int) – Number of seconds until expiration
  • $domain (string) – Cookie domain (usually: .yourdomain.com)
  • $path (string) – Cookie path
  • $prefix (string) – Cookie name prefix
  • $secure (bool) – Whether to only send the cookie through HTTPS
  • $httponly (bool) – Whether to hide the cookie from JavaScript
Return type:

void

This helper function gives you friendlier syntax to set browser cookies. Refer to the Input Library for a description of its use, as this function is an alias for CI_Input::set_cookie().

get_cookie($index[, $xss_clean = NULL]])¶
Parameter:
  • $index (string) – Cookie name
  • $xss_clean (bool) – Whether to apply XSS filtering to the returned value
Kembali:

The cookie value or NULL if not found

Return type:

mixed

This helper function gives you friendlier syntax to get browser cookies. Refer to the Input Library for detailed description of its use, as this function acts very similarly to CI_Input::cookie(), except it will also prepend the $config['cookie_prefix'] that you might’ve set in your application/config/config.php file.

delete_cookie($name[, $domain = ''[, $path = '/'[, $prefix = '']]]])¶
Parameter:
  • $name (string) – Cookie name
  • $domain (string) – Cookie domain (usually: .yourdomain.com)
  • $path (string) – Cookie path
  • $prefix (string) – Cookie name prefix
Return type:

void

Lets you delete a cookie. Unless you’ve set a custom path or other values, only the name of the cookie is needed.

delete_cookie('name');

This function is otherwise identical to set_cookie(), except that it does not have the value and expiration parameters. You can submit an array of values in the first parameter or you can set discrete parameters.

delete_cookie($name, $domain, $path, $prefix);
Next Previous

© Copyright 2014 - 2015, British Columbia Institute of Technology. Terakhir diperbarui pada Mar 10, 2017.

Built with Sphinx using a theme provided by Read the Docs.