在任何人认为之前已解决此问题之前,请先听我说。从根本上讲,我有这个简单的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请求的标头,对吗?甚至都不确定,这只是我挖掘出的一件事,显示出台式机和移动设备之间的差异。