如果我在page.ctp做的print_r($ _ SESSION)我得到:CakePHP的(1.3) - 訪問會話視圖瓦爾
Array
(
[Config] => Array
(
[userAgent] => b3346028c15f82ac5d4b25c4f50d8718
[time] => 1281034201
[timeout] => 100
)
[manualLogout] => 1
[Message] => Array
(
)
[Auth] => Array
(
[redirect] => /events/add/controller:events
)
[facebookSynced] => 1
)
的VAR facebookSynced我在控制器中設置與$這個 - >會話寫入() - 並且它在會話中按預期方式。但是,當我從page.ctp做PR($這個 - >會議)或PR($ session中)我得到:
SessionHelper Object
(
[helpers] => Array
(
)
[__active] => 1
[valid] =>
[error] =>
[_userAgent] => b3346028c15f82ac5d4b25c4f50d8718
[path] =>/
[lastError] =>
[security] => medium
[time] => 1281016202
[sessionTime] => 1281034202
[watchKeys] => Array
(
)
[id] =>
[host] =>
[timeout] =>
[base] => /Eclipse/Calc_1.3.2/trunk
[webroot] => /Eclipse/Calc_1.3.2/trunk/
[here] => /Eclipse/Calc_1.3.2/trunk/users/login
[params] => Array
(
[controller] => users
[action] => login
[named] => Array
(
)
[pass] => Array
(
)
[plugin] =>
[form] => Array
(
)
[url] => Array
(
[url] => users/login
)
[models] => Array
(
[0] => User
)
)
[action] => login
[data] =>
[theme] =>
[plugin] =>
)
如何訪問與facebookSynced VAR在它我的會議,什麼是這兩個'會議'之間的區別。額外的信息:在core.php中我有:
Configure::write('Session.save', 'php');
Configure::write('Session.cookie', 'CAKEPHP');
Configure::write('Session.save', 'custom_sesh');
Configure::write('Session.timeout', '180');
Configure::write('Session.checkAgent', true);
Configure::write('Session.start', true);
custom_sesh的內容只有一行:
ini_set('session.cookie_lifetime', 0);
提示:使用調試($ this),而不是print_r 有時你不記得你把它放在哪裏..並發現它需要很多時間..與調試..在輸出它給你的行號和文件名也..其中有很好的使用它:D – 2010-08-05 18:38:13