">

CDbException

数据库中无法找到 active record class "Article" 对应的 table "{{article}}".

D:\wwwroot\jiangong_jishi\framework\db\ar\CActiveRecord.php(2385)

2373 
2374     /**
2375      * Constructor.
2376      * @param CActiveRecord $model the model instance
2377      * @throws CDbException if specified table for active record class cannot be found in the database
2378      */
2379     public function __construct($model)
2380     {
2381         $this->_modelClassName=get_class($model);
2382 
2383         $tableName=$model->tableName();
2384         if(($table=$model->getDbConnection()->getSchema()->getTable($tableName))===null)
2385             throw new CDbException(Yii::t('yii','The table "{table}" for active record class "{class}" cannot be found in the database.',
2386                 array('{class}'=>$this->_modelClassName,'{table}'=>$tableName)));
2387                 
2388         if(($modelPk=$model->primaryKey())!==null || $table->primaryKey===null)
2389         {
2390             $table->primaryKey=$modelPk;
2391             if(is_string($table->primaryKey) && isset($table->columns[$table->primaryKey]))
2392                 $table->columns[$table->primaryKey]->isPrimaryKey=true;
2393             elseif(is_array($table->primaryKey))
2394             {
2395                 foreach($table->primaryKey as $name)
2396                 {
2397                     if(isset($table->columns[$name]))

Stack Trace

#3
+
 D:\wwwroot\jiangong_jishi\protected\modules\qcyjdjsx\controllers\ShowController.php(9): CActiveRecord->findByPk(956)
04     public function actionIndex()
05     {
06         $id = intval($this->_request->getParam('id'));
07 
08         //点击查看数加1
09         $article = Article::model()->findByPK($id);
10         $article->hits += 1;
11         if(!$article->save()){
12             $this->showMsg("系统错误","-1");
13         }
14 
#11
+
 D:\wwwroot\jiangong_jishi\index.php(41): CApplication->run()
36     }
37     exit ();
38 }
39 
40 require_once($yii);
41 Yii::createWebApplication($config)->run();
42 
43 
44 
45 
2019-05-13 05:26:38 微软-IIS/7.5 Yii Framework/1.1.16
XML 地图 | Sitemap 地图