4

これは私を夢中にさせています。私のAppControllerには、次のものがあります。

public function beforeFilter() {
    $this->Cookie->name = 'MyCookie';
    $this->Cookie->time =  '1 year';
    $this->Cookie->domain = 'http://mydomain.com';
    $firstVisit = $this->Cookie->read('foo');
    if ( empty($firstVisit) ) {
        $this->set('firstVisit', true);
        $this->Cookie->write('foo', 'true');
    } else {
        $this->set('firstVisit', false);
    }
}

これは機能するはずですが、何も返されず、Cookie は完全に空白です。

Cake が実際に Cookie を保存するのを妨げている可能性があるのは何ですか?

4

2 に答える 2

2

http://壊れる原因でした。それを削除すると問題が解決しました。

于 2013-03-11T14:40:15.690 に答える