Skip to main content
  • 博客
    • div+css 博客
    • javascript 博客
      • vue 博客
    • php 博客
      • 微信 博客
  • php
    • drupal
    • composer
    • thinkphp
    • onethink
    • laravel
    • Swoole
    • dedecms
    • magento
    • smarty
    • ecshop
    • zencart
    • joomla
    • discuz
    • wordpress
    • yii
    • 微信
    • 抖音
    • ci
    • weiphp
    • destoon
  • python
    • plone
  • apache
  • nginx
  • cache
    • memcache
    • redis
  • div+css
  • javascript
    • jquery
    • typescript
    • Vue.js
    • Amaze
    • zepto
    • react
    • underscore
    • backbone
    • angular
    • lodash
    • layui
    • js特效
  • vbscript
  • photoshop ai
  • sql
    • mysql
    • mssql
    • oracle
  • regular
  • node.js
  • 腾讯开放平台
  • dreamweaver
  • linux
  • seo
  • app
  • asp及asp.net
  • flash
  • iis
  • java
  • mac
  • wap
  • windows
    • dos
    • 打印机
  • 其它
  • 浏览器
  • 网络
  • AD域 (exchange)
  • 虚拟机
  • AC
  • ai
  • 简写翻译

欢迎各位兄弟 发布技术文章

这里的技术是共享的

个人技术网_前端_后台_php_div_css_linux_javascript_seo 个人技术网_前端_后台_php_div_css_linux_javascript_seo

搜索表单

用户登录

  • 重设密码

You are here

首页

Cookie 辅助函数

星期二, 2016-08-16 13:18 — adminshiping1
 CodeIgniter
 
  • 欢迎使用 CodeIgniter
  • 安装说明
  • CodeIgniter 概览
  • 教程 - 内容提要
  • 向 CodeIgniter 贡献你的力量
  • 常规主题
  • 类库参考
  • 数据库参考
  • 辅助函数参考
    • 数组辅助函数
    • 验证码辅助函数
    • Cookie 辅助函数
    • 日期辅助函数
    • 目录辅助函数
    • 下载辅助函数
    • 邮件辅助函数
    • 文件辅助函数
    • 表单辅助函数
    • HTML 辅助函数
    • Inflector 辅助函数
    • 语言辅助函数
    • 数字辅助函数
    • 路径辅助函数
    • 安全辅助函数
    • 表情辅助函数
    • 字符串辅助函数
    • 文本辅助函数
    • 排版辅助函数
    • URL 辅助函数
    • XML 辅助函数
toc
  • 首页 »
  •  
  • 辅助函数参考 »
  •  
  • Cookie 辅助函数
  •  

Cookie 辅助函数

Cookie 辅助函数文件包含了一些帮助你处理 Cookie 的函数。

  • 加载辅助函数
  • 可用函数
 

加载辅助函数

该辅助函数通过下面的代码加载:

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

可用函数

该辅助函数有下列可用函数:

set_cookie($name[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = FALSE[, $httponly = FALSE]]]]]]]])
参数:
  • $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
返回类型:

void

该辅助函数提供给你一种更友好的语法来设置浏览器 Cookie,参考 输入类 获取它的详细用法,另外,它是 CI_Input::set_cookie()函数的别名。

get_cookie($index[, $xss_clean = NULL]])
参数:
  • $index (string) -- Cookie name
  • $xss_clean (bool) -- Whether to apply XSS filtering to the returned value
返回:

The cookie value or NULL if not found

返回类型:

mixed

该辅助函数提供给你一种更友好的语法来获取浏览器 Cookie,参考 输入类 获取它的详细用法,同时,这个函数 和CI_Input::cookie() 函数非常类似,只是它会根据配置文件 application/config/config.php 中的 $config['cookie_prefix'] 参数 来作为 Cookie 的前缀。

delete_cookie($name[, $domain = ''[, $path = '/'[, $prefix = '']]]])
参数:
  • $name (string) -- Cookie name
  • $domain (string) -- Cookie domain (usually: .yourdomain.com)
  • $path (string) -- Cookie path
  • $prefix (string) -- Cookie name prefix
返回类型:

void

删除一条 Cookie,只需要传入 Cookie 名即可,也可以设置路径或其他参数 来删除特定 Cookie。

delete_cookie('name');

这个函数和 set_cookie() 比较类似,只是它并不提供 Cookie 的值和 过期时间等参数。第一个参数也可以是个数组,包含多个要删除的 Cookie 。 另外,你也可以像下面这样删除特定条件的 Cookie 。

delete_cookie($name, $domain, $path, $prefix);
下一个主题  上一个主题
来自 http://codeigniter.org.cn/user_guide/helpers/cookie_helper.html

普通分类: 
ci
Powered by Drupal

友情链接

校园好文网

 www.shipingzhong.cn  个人技术网_前端_后台    备案号:苏ICP备18010659号-2