class GroupsController extends AppController {
public function beforeFilter() {
parent::beforeFilter();
debug($this->Session->read('selected')); // ="c" I expect
debug($this->request->query('selected'));
if ($this->request->query('selected') != null){
$this->Session->write("selected",$this->request->query('selected'));
}
debug($this->Cookie->read("test")); //== array('SID' => 'm3fmjpdp9c2',**I want this 'test' => 'test'**)
if ($this->Cookie->read("test") == null){
$this->Cookie->write("test","test");
debug("newed");
}
debug($this->Cookie->read("test")); // == array( 'SID' => 'mjpdp9c2', 'test' => 'test' )
}
/**
* Components
*
* @var array
*/
public $components = array('Paginator');
/**
* index method
*
* @return void
*/
public function index() {
$this->Group->recursive = 0;
$this->set('groups', $this->Paginator->paginate());
debug($this->Session->read('selected'));
}
此网址为cakephp / groups
第1个cakephp / groups?选择= c 调试($这 - >会话而>读取( '选择')); // =“c” 它返回
第二个cakephp / groups
我想要 调试($这 - >会话而>读取( '选择')); // =“c”我希望
第二次。但现在为空。