使用PHP获取/读取Javascript Cookie [英] Get/Read Javascript cookie with PHP
本文介绍了使用PHP获取/读取Javascript Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个理论性的问题。
I have a theoretical question..
我知道您可以通过使用 document.cookie 使用JavaScript获取/读取PHP cookie。 >
I know that you can get/read a PHP cookie with javascript by using: document.cookie
在PHP中有类似的方法吗?
Is there a similar way to do this in PHP?
PHP可以获取/读取一个Cookie吗?是用JavaScript创建的?
如果是,那么您该怎么做?
Can PHP get/read a cookie that is created i JavaScript? If yes, then how can you do that?
推荐答案
您可以使用 $ _ COOKIE
,即超级全局。就像引用任何数组一样引用它,其中 $ _ COOKIE ['key_name']
是您要访问的cookie。
You can use $_COOKIE
, the superglobal. Just reference it like you would any array, where $_COOKIE['key_name']
is the cookie you want to access.
请参见 PHP API文档。
这篇关于使用PHP获取/读取Javascript Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文