当请求来自移动设备时,session_start()无法访问/ tmp目录

时间:2019-02-16 13:27:21

标签: php session mobile

在任何人认为之前已解决此问题之前,请先听我说。从根本上讲,我有这个简单的PHP代码段:

<?PHP
session_start();
echo "My session ID is: " . session_id();
?>

当我从任何桌面导航到它时,都很好。当我从任何移动设备导航到它时,都会得到:

Uncaught Exception: Cannot open source device in /sessionTest.php:4
Stack trace:
#0 /sessionTest.php(4): session_start()
#1 {main}

Next Exception: Cannot open source device in /sessionTest.php:4
Stack trace:
#0 /sessionTest.php(4): session_start()
#1 {main}

Next Exception: Cannot open source device in /sessionTest.php:4
Stack trace:
#0 /sessionTest.php(4): session_start()
#1 {main}

Next Exception: Cannot open source device in /sessionTest.php:4
Stack trace:
#0 /sessionTest.php(4): session_start()
#1 {main}

Next Error: Failed to create session ID: files (path: /tmp) in /sessionTest.php:4
Stack trace:
#0 /sessionTest.php(4): session_start()
#1 {main}

我创建了这个小代码段:

foreach (getallheaders() as $name => $value) {
    echo "$name: $value\n";
}

从桌面上,我看到以下内容:PHPSESSID = xxxxxxxxxxx 对于移动设备,这从未设置过。这让我更加困惑,因为这些是来自http请求的标头,对吗?甚至都不确定,这只是我挖掘出的一件事,显示出台式机和移动设备之间的差异。

0 个答案:

没有答案