|
bootstrap.php已经加载了orm、database
在classes/models也创建了topic.php。内容如下:
PHP复制代码
<?php
!defined('SYSPATH') && exit('Access denied');
class Model_Topic extends ORM {
protected $primary_key = 'topic_id';
protected $_belongs_to = array(
'author' => array(
'model' => 'member',
'foreign_key' => 'topic_member_id',
)
);
}
复制代码
classes/controller/home.php如下:
PHP复制代码
<?php
class Controller_Home extends Controller {
private $obj_user;
public function before () {
$this->obj_user = ORM ::Factory('topic');
}
public function action_index () {
$this->request->response = View ::factory('home/index')->set('date',date('m/d/y'))->bind('test',$test);
$test = 'hello';
}
}
复制代码
提示:ErrorException [ Fatal Error ]: Class 'Model_Topic' not found.
Why? |
|