当我编写此代码时,似乎正确
<?php
session_start();
$_SESSION['test'] = 'test';
echo $_SESSION['test'];//'test'
但是当我更改这样的代码并刷新浏览器时:
<?php
session_start();
echo $_SESSION['test'];//nothing
在我的灯(linux + apache + mysql + php)中,我可以测试&#39;在第二个代码中,但不在lnmp(linux + nginx + mysql + php)
在php.ini中:
session.auto_start = 1
在nginx conf:
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
}
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
帮帮我。