私にはわからない理由で、顧客の名前を含むセッション変数がしばらくの間表示され、その後消えます。
app_controller.phpの場合:beforeFilter()
if (isset($_SESSION['customer_name']) == false ||
strlen($_SESSION['customer_name']) == 0)
{
$customer = $this->Customer->read(null, $auth['User']['customer_id']);
$name = $customer['Customer']['fname'] . " " . $customer['Customer']['lname'];
$this->Session->write('customer_name', $name);
$this->set('name', $this->Session->read('customer_name'));
}
else
{
$this->set('name', $this->Session->read('customer_name'));
}
セッションが設定されているかどうかを確認するためのバリエーションを試しました。
if ($this->Session->check('customer_name') == false)
すべてが同じ奇妙な方法で動作し、しばらくの間ビューに表示されてから消えます。ブラウザを閉じたり、再度ログインしたりしても元に戻りません。そのコードへのランダムな小さな変更は、それを短期間で生き返らせるようです。