What means “secure” parameter for session_set_cook

2019-02-28 04:43发布

Possible Duplicate:
PHP session_set_cookie_params

I am using only HTTP (not HTTPS, SSL is not configured on my server).

Does "secure" mean that cookies will be transfered only via SSL? Or it is possible to use this parameter with HTTP too?

1条回答
我只想做你的唯一
2楼-- · 2019-02-28 05:42

It means the browser will only send the cookie when the current connection is encrypted (SSL/TLS). You only use it with an encrypted connection.

You can optionally set the HttpOnly flags as well to prevent client-side scripts from accessing cookie as well to help secure it further. So in your case set the 'secure' flag to FALSE and the the HttpOnly flag to TRUE. That is as secure as your cookie setting will get other than setting a path which you are most likely wanting as / anyways.

查看更多
登录 后发表回答