PHP + Javascript-读/写Cookies [英] PHP + Javascript - Read/Write Cookies

查看:73
本文介绍了PHP + Javascript-读/写Cookies的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用javascript创建cookie,然后使用PHP读取它?那么另一种方式呢?

Is it possible to create a cookie with javascript and then read it with PHP? And What about the other way around?

推荐答案

是的,您可以同时设置和读取cookie。

Yes you can both set and read cookies on either side.

在javascript方面,您需要解析 document.cookie 变量,但是有很多库可以做到这一点(jQuery有一个插件可以做到这一点。)

On the javascript side you'll need to parse the document.cookie variable, but there are plenty of libs to do that (jQuery has a plugin to do so).

这篇关于PHP + Javascript-读/写Cookies的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆