cookie httponly属性

Marks the cookie as accessible only through the HTTP protocol. This means that the cookie won't be accessible by scripting languages, such as JavaScript. This setting can effectively help to reduce identity theft through XSS attacks (although it is not supported by all browsers).

 

拥有 httponly 属性的cookie只能通过http协议访问,这也就意味着该cookie将不再允许通过脚本语言(如javascript)进行访问,本属性的设置能有效的减少XSS(跨站点脚本攻击),尽管该属性尚不能被所有浏览器所支持。

 

PHP httponly属性设置

 

1、PHPSESSIONID 设置

打开文件php.ini,修改如下:

Php代码   收藏代码
  1. session.cookie_httponly =1  

 

 

2、自定义cookie的设置

 

bool setcookie ( string $name [, string $value [, int $expire = 0 [, string $path [, string $domain [, bool $secure = false [, bool $httponly = false ]]]]]] )

转自:http://huangqiqing123.iteye.com/blog/1912588

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值