0
A
回答
1
也許你不設置defaultSchema在連接字符串
return [
'class' => 'yii\db\Connection',
'dsn' => 'pgsql:host=localhost;dbname=db_name',
'username' => 'db_username',
'password' => 'db_password',
'charset' => 'utf8',
'schemaMap' => [
'pgsql'=> [
'class'=>'yii\db\pgsql\Schema',
'defaultSchema' => 'public' //specify your schema here
]
], // PostgreSQL
];
或 更改tableName()
函數模型這樣
/**
* @inheritdoc
*/
public static function tableName()
{
return 'schemaName.table_name';
}
相關問題
- 1. Amazon S3和Yii2
- 2. Yii2 DatePicker和DataBase
- 3. Yii2,Facebook和Twig
- 4. Yii2和Reportico
- 5. YII2 Restful post和TimestampBehavior
- 6. Yii2:has_many gridview和detailview
- 7. 總和的foreach yii2
- 8. Yii2 Postgres的錯誤 - fe_sendauth:沒有密碼提供
- 9. Node.js和postgres LISTEN
- 10. Postgres和JDBC
- 11. ASP MVC和postgres
- 12. JPA和Postgres generate_series
- 13. python:csv.reader&unicode(和postgres)
- 14. krakenjs和node postgres
- 15. Postgres,Rails和GROUP
- 16. Postgres和詞雲
- 17. Yii2 - 在Yii2
- 18. Yii2:SQLSTATE [42S22]:列Yii2
- 19. Navicat,Object DB和Postgres
- 20. GROUP BY和Postgres的
- 21. Postgres和臨時表
- 22. SQLAlchemy(Postgres)和事務
- 23. Postgres LEFT JOIN和COUNT
- 24. Rails,Postgres和時區
- 25. 油滑,UUID和Postgres
- 26. 回形針和Postgres
- 27. Jhipster和Postgres連接
- 28. ActiveRecord的find_each和Postgres
- 29. Yii2和Git忽略文件
- 30. 如何配置和`在Yii2
您沒有** ** tbl_user數據庫中?! –
您是否創建了名爲'tbl_user'的模型?或者它是你的表名?如果這是模型而不是它,那就是爲什麼你有錯誤。如果這應該是表名回到[指南](http://www.yiiframework.com/doc-2.0/guide-db-active-record.html)並閱讀有關ActiveRecord。 – Bizley
是的,先生tbl_user是我的表名。謝謝先生@Bizley現在的工作,我創建了一個與我的表同名的模型。 – DULF