简体   繁体   English

为什么我的PHP $ _SESSION [sessionvar]在iPhone中的页面之间丢失了?

[英]Why are my PHP $_SESSION[sessionvar] getting lost between pages in on iPhone?

I'm using the basic framework of the a php login form provided here: http://www.html-form-guide.com/php-form/php-login-form.html 我正在使用此处提供的php登录表单的基本框架: http : //www.html-form-guide.com/php-form/php-login-form.html

It works great when I am on a Mac or PC. 当我在Mac或PC上使用时,效果很好。 When login from an iPhone, the $_SESSION array is empty, so the identify of the logged in user is lost, and the system wasn't to redirect to login.php. 从iPhone登录时,$ _SESSION数组为空,因此已登录用户的标识丢失,并且系统无法重定向到login.php。

How can I prevent the $_SESSION array from getting wiped out? 如何防止$ _SESSION数组被清除?

Probably your iPhone browser does not have cookies enabled. 您的iPhone浏览器可能未启用Cookie。 Due to security reasons, the PHP sessions default to cookie usage, however there is a second way using a GET parameter as well, often called SID . 由于安全原因,PHP会话默认使用cookie,但是还有另一种使用GET参数的方法,通常称为SID Make use of that get parameter and you should be fine for cookie-less browsers. 利用该get参数,对于无cookie的浏览器应该没问题。

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

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