为子域名设置Cookie php / javascript

时间:2022-08-23 10:33:39

I am making a website where we are going to sell t-shirts. All I want to do is to be able to choose a size and color and then ad to cart. The options are going to be tags, so i want to store three values in a cookie/cookies (What shirt, what size and what color). I want to be able to access the cookie from other sites. At the checkout i just want the customer to fill in a form with name and adress and all that and all the information (the order) will be sent to our email. I don't want to involve any payment method, it will be handled another way. I have no knowledge/ experience in php and nearly none in javascript, but i as long as you describe it well, I will understand. I appreciate all help I can get :)

我正在建立一个我们要出售T恤的网站。我想要做的就是能够选择尺寸和颜色然后广告到购物车。选项将是标签,所以我想在cookie / cookies中存储三个值(什么衬衫,什么尺寸和什么颜色)。我希望能够从其他网站访问cookie。在结账时,我只希望客户填写一份包含姓名和地址的表格,所有这些信息(订单)将发送到我们的电子邮箱。我不想涉及任何付款方式,它将以另一种方式处理。我没有PHP的知识/经验,几乎没有javascript,但我只要你描述得好,我会理解。我感谢所有帮助,我可以得到:)

1 个解决方案

#1


0  

You can't get cookies from other web-sites on different domains.

您无法从不同域上的其他网站获取Cookie。

To add cookies you have to do

要添加cookie,您必须这样做

document.cookie = 'userName=User; shirtSize=xl;' 

and so on

等等

#1


0  

You can't get cookies from other web-sites on different domains.

您无法从不同域上的其他网站获取Cookie。

To add cookies you have to do

要添加cookie,您必须这样做

document.cookie = 'userName=User; shirtSize=xl;' 

and so on

等等