<?php
class PublishersController extends AppController
{
public function index()
{
$this->set("publishers",
$this->Publisher->find("all", array('order' => 'company_name ASC')));
}
public function view($id = null)
{
$this->Publisher->id = $id;
$this->set('publisher', $this->Publisher->read());
}
function edit($id = null)
{
$this->Publisher->id = $id;
if (empty($this->data))
{
$this->data = $this->Publisher->findById($id);
}
else
{
if ($this->Publisher->save($this->data))
{
$this->Session->setFlash('Publisher Updated Successfully');
$this->redirect(array('action' => 'index'));
}
}
}
}
?>
Run Code Online (Sandbox Code Playgroud)
小智 5
看起来你还没有加载Session类.
在AppController或PublisherController中,您需要添加以下内容:
public $components = array('Session');
Run Code Online (Sandbox Code Playgroud)
那应该解决它.
| 归档时间: |
|
| 查看次数: |
1713 次 |
| 最近记录: |