Is it possible to get a stored cookie's path?

后端 未结 4 1779
面向向阳花
面向向阳花 2020-12-17 20:18

Quick question: One can set the path where a cookie is valid, but is it also possible to get (read) this path from the cookie (in PHP)?

Or else: is it possi

4条回答
  •  醉酒成梦
    2020-12-17 20:32

    There is no way for PHP to read path of the cookie because browser sends to the server only values of the cookies that should be sent, nothing more.

    You might try to re-set cookie without giving path but I highly doubt it will work. There might be many different relevant cookies with same name and less and more precise paths. If you tried to set up cookie with same name but without path browser would not know which of the cookies it should update (maybe the one wit most precise path? but that could lead to (security?) errors when precise cookie you expect to be set is not set).

提交回复
热议问题