<?php namespace app\controllers; use yii\web\Controller; use app\models\Users; class IndexController extends Controller{ public function actionIndex(){ //查詢數(shù)據(jù) $sql = 'select * from users where id=1'; ? ? ? ? ? ? ? ? ?//改這里 $results=Users::findBySql($sql)->all(); print_r($results); } }查詢一次數(shù)據(jù)庫中users表后,刪掉users表,新建一個users1表,將上述代碼改為<?phpnamespace app\controllers;use yii\web\Controller;use app\models\Users;class IndexController extends Controller{public function actionIndex(){//查詢數(shù)據(jù)$sql = 'select * from users1 where id=1'; ? ? ? ? ? ? ? ? ?//這里做了改動$results=Users::findBySql($sql)->all();print_r($results);}}刷新頁面為什么提示Invalid Configuration – yii\base\InvalidConfigExceptionThe table does not exist: {{%users}}我明明要查詢users1了呀,為什么還查詢之前的users?
- 1 回答
- 0 關(guān)注
- 1470 瀏覽
添加回答
舉報
0/150
提交
取消