[英]Session is not storing variable PHP
I have started session
in the header.php
and included in all files but when I declare a variable like $_SESSION['var_name']="Hello";
我已经在header.php
启动了session
并包含在所有文件中,但是当我声明一个像$_SESSION['var_name']="Hello";
这样的变量时$_SESSION['var_name']="Hello";
and get it on other file like echo $_SESSION['var_name'];
并将其放在其他文件上,例如echo $_SESSION['var_name'];
and I have my php.ini
in the folder which contains我的php.ini
包含在文件夹中
session.save_path = "C:\Xampp\tmp"
But it's return null
& when i use print_r($_SESSION);
但是当我使用print_r($_SESSION);
时它返回null
& it's return array( )
.它是 return array( )
。 I removed php.ini
file and restart the xampp server but didn't get any thing.我删除了php.ini
文件并重新启动了 xampp 服务器,但没有得到任何东西。
Thanks for your contribution but I found the solution I created .htaccess
and put content感谢您的贡献,但我找到了我创建的解决方案.htaccess
并放置了内容
<IfModule php7_module>
session.save_path = "C:\Xampp\tmp"
</IfModule>
And that works for me And my other .ini
file are containing这对我有用 我的其他.ini
文件包含
session.save_path = "C:\Xampp\tmp"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.