亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

關于YII框架

關于YII框架

PHP
琴代語兮 2015-09-23 00:54:18
<?php namespace app\controllers; use yii\web\Controller; use app\models\Users; class IndexController extends Controller{ public function actionIndex(){ //查詢數據 $sql = 'select * from users where id=1'; ? ? ? ? ? ? ? ? ?//改這里 $results=Users::findBySql($sql)->all(); print_r($results); } }查詢一次數據庫中users表后,刪掉users表,新建一個users1表,將上述代碼改為<?phpnamespace app\controllers;use yii\web\Controller;use app\models\Users;class IndexController extends Controller{public function actionIndex(){//查詢數據$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 回答

已采納
?
喏_

TA貢獻5條經驗 獲得超0個贊

$results=Users::findBySql($sql)->all();

Users這個models 里面定義了表名啊,

查看完整回答
反對 回復 2016-10-11
  • 1 回答
  • 0 關注
  • 1477 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號