简体   繁体   English

Android浏览器php cookies

[英]Android browser php cookies

I am unable to manipulate cookies via php on the vanilla android browser. 我无法在vanilla android浏览器上通过php操纵cookie。 (ver 2.3.4) (ver 2.3.4)

The browser options are set to accept cookies, and some websites do allow me to log in normally (though not all). 浏览器选项设置为接受cookie,一些网站允许我正常登录(尽管不是全部)。

I have made a really simple test script to try and see if cookies are set at all: 我已经制作了一个非常简单的测试脚本来尝试查看是否设置了cookie:

setcookie("TestCookie", "cookievalue", time()+3600);

and on the next page 并在下一页

echo $_COOKIE["TestCookie"];

On my desktop browser or on firefox mobile this displays the word "cookievalue" but on the android browser it's blank. 在我的桌面浏览器或firefox移动设备上显示“cookievalue”一词,但在android浏览器上显示为空白。 This issue also won't let me store anything in a session cookie since that won't persist. 这个问题也不会让我在会话cookie中存储任何东西,因为它不会持久存在。

Am I missing something? 我错过了什么吗?

After examining things closely and trying all options I've discovered that this is indeed a problem with how the stock browser is handling cookies when android is configured to use a port and proxy in the APN settings. 在仔细检查并尝试所有选项之后,我发现当android被配置为在APN设置中使用端口和代理时,这确实是股票浏览器如何处理cookie的问题。 I suspect that it has problems associating cookies with their domains under certain conditions when these settings are on. 我怀疑在这些设置打开时,在某些条件下将Cookie与其域名相关联时会出现问题。 (cookies were being set, but lost as soon as a page redirect or link was clicked). (正在设置cookie,但是一旦点击页面重定向或链接就丢失了)。

My provider had these in there by default. 我的提供商默认使用这些。 Removing them so that the fields are blank has solved this problem. 删除它们以使字段为空是解决了这个问题。

Anyone else having this issue, I suggest going into your wireless networks options, finding the access point names setting, selecting the active APN and clearing the port and proxy fields if they are filled in. (write them down first in case this doesn't work for you) 有其他人遇到此问题,我建议进入您的无线网络选项,找到接入点名称设置,选择活动APN并清除端口和代理字段(如果已填写)。(如果没有,请先写下来为你工作)

After you do this you'll have to re-register on your network by searching for available networks and selecting it again. 执行此操作后,您必须通过搜索可用网络并再次选择它来重新注册您的网络。

That code will not work. 该代码不起作用。 Cookie data set with setcookie does not become available until the next page request. 使用setcookie设置的Cookie数据在下一页请求之前不可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM