PHP会话和类
我觉得自己像个大傻瓜。好吧,在PHP中,我是一个noob,但那是另一个故事。 我很困惑。我为一家较小的公司编写了一个票务系统,它运行良好。 我的会话变量只有一个问题PHP会话和类,php,class,session,Php,Class,Session,我觉得自己像个大傻瓜。好吧,在PHP中,我是一个noob,但那是另一个故事。 我很困惑。我为一家较小的公司编写了一个票务系统,它运行良好。 我的会话变量只有一个问题 define('bin', 'bin/');//just the path to my binaries session_name('ticket'); require_once bin.'constants.php'; //definition of all necessary constants require_once bi
define('bin', 'bin/');//just the path to my binaries
session_name('ticket');
require_once bin.'constants.php'; //definition of all necessary constants
require_once bin.'class.php'; //Load all class files
$boolsession = session_start();
require_once bin.'handle.php'; //execute all incomming data
require_once bin.'webcontent.php'; //output the result.
这是我的问题。当我在包含类文件之前启动会话时,有些变量就不再起作用了。什么时候启动它,就像这样,只有一个变量不再启动了
这是我的用户变量,它引用了我的用户数据。
在我登录到write my session之后,我将用户名中的数据插入一个变量,并将其写入会话
$_SESSION['user'] = $user;
但当我处理更多的数据时,我的“用户”将不再工作。Var dump告诉我用户是不完整的
像这样
对象\uuuPHP\uComplete\uClass1 5{[\uuPHP\uComplete\uClass\uName]=>string4用户
在启动会话之前,确实必须包含类文件。从会话中取消序列化对象需要类的源文件。php.ini中是否有session.auto_start=true?