• CodeIgniterへようこそ
  • インストール方法
    • Codeigniter のダウンロード
    • インストール方法
    • 以前のバージョンからのアップグレード
    • トラブルシューティング
  • CodeIgniter 概要
    • CodeIgniter をはじめよう
    • CodeIgniter の簡単な紹介
    • CodeIgniter の機能
    • アプリケーションフローチャート
    • Model-View-Controller
    • 設計とアーキテクチャのゴール
  • チュートリアル
    • 静的なページ
    • News section
    • ニュース項目を作成
    • おわりに
  • Contributing to CodeIgniter
    • Writing CodeIgniter Documentation
    • Developer’s Certificate of Origin 1.1
  • 一般的なトピック
    • CodeIgniter の URL
    • コントローラ
    • 予約語
    • ビュー
    • モデル
    • ヘルパー
    • CodeIgniter のライブラリの利用
    • ライブラリの作成
    • CodeIgniter のドライバを使う
    • ドライバの作成
    • コアシステムクラスの作成
    • 補助的なクラス作成
    • フック――フレームワークコアの拡張
    • リソースのオートロード
    • 共通関数
    • 互換関数
    • URIルーティング
    • エラー処理
    • キャッシュ
    • アプリケーションのプロファイリング
    • CLI で実行する
    • アプリケーションの管理
    • 複数環境への対応
    • ビューファイルでのPHPの代替構文
    • セキュリティ
    • PHP スタイルガイド
  • ライブラリ
    • ベンチマーククラス
    • キャッシングドライバ
    • カレンダークラス
    • ショッピングカートクラス
    • 設定クラス
    • Email クラス
    • 暗号化クラス
    • 暗号化ライブラリ
    • ファイルアップロードクラス
    • フォームバリデーション(検証)
    • FTP クラス
    • 画像操作クラス
    • 入力クラス
    • JavaScript クラス
    • 言語クラス
    • ローダ (読み込み処理) クラス
    • マイグレーションクラス
    • 出力クラス
    • ページネーションクラス
    • テンプレートパーサクラス
    • セキュリティクラス
    • セッションライブラリ
    • HTML テーブルクラス
    • トラックバッククラス
    • タイポグラフィークラス
    • ユニットテストクラス
    • URI クラス
    • ユーザエージェントクラス
    • XML-RPC および XML-RPC サーバクラス
    • Zip圧縮クラス
  • データベースリファレンス
    • クイックスタート: 使用例
    • データベース設定
    • データベースへの接続
    • クエリの実行
    • クエリ結果の生成
    • クエリヘルパー関数
    • クエリビルダクラス
    • トランザクション
    • メタデータの取得
    • カスタム関数呼び出し
    • クエリキャッシュ
    • データベースフォージを使用したデータベース操作
    • データベースユーティリティクラス
    • データベースドライバリファレンス
  • ヘルパー
    • 配列ヘルパー
    • キャプチャ ヘルパー
    • Cookie ヘルパー
    • 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
  • CodeIgniterへようこそ
  • インストール方法
    • Codeigniter のダウンロード
    • インストール方法
    • 以前のバージョンからのアップグレード
    • トラブルシューティング
  • CodeIgniter 概要
    • CodeIgniter をはじめよう
    • CodeIgniter の簡単な紹介
    • CodeIgniter の機能
    • アプリケーションフローチャート
    • Model-View-Controller
    • 設計とアーキテクチャのゴール
  • チュートリアル
    • 静的なページ
    • News section
    • ニュース項目を作成
    • おわりに
  • Contributing to CodeIgniter
    • Writing CodeIgniter Documentation
    • Developer’s Certificate of Origin 1.1
  • 一般的なトピック
    • CodeIgniter の URL
    • コントローラ
    • 予約語
    • ビュー
    • モデル
    • ヘルパー
    • CodeIgniter のライブラリの利用
    • ライブラリの作成
    • CodeIgniter のドライバを使う
    • ドライバの作成
    • コアシステムクラスの作成
    • 補助的なクラス作成
    • フック――フレームワークコアの拡張
    • リソースのオートロード
    • 共通関数
    • 互換関数
    • URIルーティング
    • エラー処理
    • キャッシュ
    • アプリケーションのプロファイリング
    • CLI で実行する
    • アプリケーションの管理
    • 複数環境への対応
    • ビューファイルでのPHPの代替構文
    • セキュリティ
    • PHP スタイルガイド
  • ライブラリ
    • ベンチマーククラス
    • キャッシングドライバ
    • カレンダークラス
    • ショッピングカートクラス
    • 設定クラス
    • Email クラス
    • 暗号化クラス
    • 暗号化ライブラリ
    • ファイルアップロードクラス
    • フォームバリデーション(検証)
    • FTP クラス
    • 画像操作クラス
    • 入力クラス
    • JavaScript クラス
    • 言語クラス
    • ローダ (読み込み処理) クラス
    • マイグレーションクラス
    • 出力クラス
    • ページネーションクラス
    • テンプレートパーサクラス
    • セキュリティクラス
    • セッションライブラリ
    • HTML テーブルクラス
    • トラックバッククラス
    • タイポグラフィークラス
    • ユニットテストクラス
    • URI クラス
    • ユーザエージェントクラス
    • XML-RPC および XML-RPC サーバクラス
    • Zip圧縮クラス
  • データベースリファレンス
    • クイックスタート: 使用例
    • データベース設定
    • データベースへの接続
    • クエリの実行
    • クエリ結果の生成
    • クエリヘルパー関数
    • クエリビルダクラス
    • トランザクション
    • メタデータの取得
    • カスタム関数呼び出し
    • クエリキャッシュ
    • データベースフォージを使用したデータベース操作
    • データベースユーティリティクラス
    • データベースドライバリファレンス
  • ヘルパー
    • 配列ヘルパー
    • キャプチャ ヘルパー
    • Cookie ヘルパー
    • 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 »
  • ヘルパー »
  • Cookie ヘルパー
  • classic layout

Cookie ヘルパー¶

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

  • ヘルパーをロードする
  • 利用できる機能

ヘルパーをロードする¶

This helper is loaded using the following code:

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

利用できる機能¶

The following functions are available:

set_cookie($name[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = FALSE[, $httponly = FALSE]]]]]]])¶
Parameters:
  • $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])¶
Parameters:
  • $index (string) – Cookie name
  • $xss_clean (bool) – Whether to apply XSS filtering to the returned value
Returns:

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 = '']]])¶
Parameters:
  • $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 - 2016, British Columbia Institute of Technology. Last updated on May 10, 2025.

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