当前位置:Gxlcms > PHP教程 > cakephp有关问题

cakephp有关问题

时间:2021-07-01 10:21:17 帮助过:37人阅读

cakephp问题
这个是我写的代码:

  class BooksController extends AppController
{
var $name='Books';
var $help='form';
function index() {
$this->Book->recursive = 1;
$books = $this->Book->find('all',array('field'=>array('Book.isbn','Book.title','Author.name')));
$this->set('books', $books);
}
function add()
{
if(!empty($this->data))
{
$this->Book->create();
$this->Book->save($this->data);
$this->redirect(array('action'=>'index'));
}
$authors = $this->Book->Author->generateList();
$this->set('$authors',$authors);
}
}
?>

然后出现这个问题

该怎样解决呢?

分享到:


------解决方案--------------------
估计是这句$authors = $this->Book->Author->generateList(); 有问题试试$authors = $this->Book->generateList();

人气教程排行