Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 打开cookie的https标志_Php_Html_Cookies_Setcookie_Cookie Httponly - Fatal编程技术网

Php 打开cookie的https标志

Php 打开cookie的https标志,php,html,cookies,setcookie,cookie-httponly,Php,Html,Cookies,Setcookie,Cookie Httponly,所以我使用的是PHP4中的这个遗留应用程序。 我正在尝试设置httponly标志和安全标志 这是我的代码: header( "Set-Cookie:". $cookieName."=".$sessId."; expires=".$expireSeconds."; sessionID=".$sessId.";path=".$path."; domain=".$domain."; httponly; secure"); 已启用安全标志,但未启用httponly 可能是因为URL使用https协议

所以我使用的是PHP4中的这个遗留应用程序。 我正在尝试设置httponly标志和安全标志

这是我的代码:

header( "Set-Cookie:". $cookieName."=".$sessId."; expires=".$expireSeconds."; sessionID=".$sessId.";path=".$path."; domain=".$domain."; httponly; secure");
已启用安全标志,但未启用httponly

可能是因为URL使用https协议

编辑: 此外,expire字段是否需要秒。马上 $expireSeconds=14400;
如果不需要秒作为参数,我如何修改代码以纠正此问题。

如果有可用的时间,为什么要通过
header()
执行此操作?此功能在PHP4中可用

setcookie($cookieName, $sessID, $expireSeconds, $path, $domain, true, true);
                                                                ^--secure
                                                                      ^--http 

httponly标志在php 4的setcookie函数中不可用