提升cookie安全性

    xiaoxiao2026-03-26  4

    提升cookie安全性的两个属性

    httponly

    当设置httponly,通过js,flash无法获取cookie信息有效的防止了xss统计,注意不能完全防止xss的攻击,只是增加了难度

    secure

    当设置了secure,只有https的请求,才会发送cookie,越来越多的网站采用https了有效的阻止了cookie在传送过程中的数据泄露

    php例子

    bool setcookie ( string $name [, string $value = "" [, int $expire = 0 [, string $path = "" [, string $domain = "" [, bool $secure = false [, bool $httponly = false ]]]]]] ) setcookie("TestCookie", ‘test’, time()+3600, "/", "example.com", true, true); 相关资源:python入门教程(PDF版)
    最新回复(0)