我正在尝试 Gas ORM,并设法自动生成我的模型,现在需要对其进行测试。但是,我似乎无法访问新生成的模型。
我已自动加载库,并将配置设置为:
配置/gas.php
$config['models_path'] = array('GasModel' => APPPATH.'gas');
气体/useraccounts.php
<?php namespace GasModel;
/* This basic model has been auto-generated by the Gas ORM */
use \Gas\Core;
use \Gas\ORM;
class UserAccounts extends ORM {
public $primary_key = 'id';
function _init()
{
self::$fields = array(
'id' => ORM::field('auto[11]'),
...
);
}
}
控制器/user.php
public function test() {
GasModel\UserAccounts::all()
}
然而,尝试访问它会引发致命错误:
PHP Fatal error: Class 'GasModel\UserAccounts' not found in applications/controllers/user.php on line 28
谁能帮我解决这个问题?