I thought I would be able to get a session variable from within a plugin component with $this->Session->var but it looks like $this->Session is not available. How do I access the session from the开发者_开发技巧 main app?
Because the Session is the component you need to include it with:
<?php
class MyComponent extends Object {
// This component uses other components
var $components = array('Session', 'Math');
function doStuff() {
$result = $this->Math->doComplexOperation(1, 2);
$this->Session->write('stuff', $result);
}
}
?>
You should check this from where the sample is taken.
This might help you out: http://book.cakephp.org/view/173/Sessions
精彩评论