私はこの命令に従うことをしようとしている:http://www.yiiframework.com/doc-2.0/guide-db-active-record.html#db-connectionYII2でデータを出力する方法は?
私はそれに接続されたデータベース(MAMPサーバー)、(応答200)を作成しましたが、何もページに出力されません。
をdb.phpファイル:githubの上
return [
// 'class' => 'yii\db\Connection',
// test begin
'class' => 'yii\db\Connection',
// test end
'dsn' => 'mysql:host=localhost;dbname=yii2basic',
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
];
コード:https://github.com/rinatoptimus/yii-test/tree/master/basic
これはdb接続のみです。この出力は出力されません。create ssqlコマンドにconnect(通常はYii :: $ app-> db)を使用するか、アクティブなレコード機能を使用することもできますhttp://www.yiiframework.com/doc-2.0/guide-db-dao.html ..、http://www.yiiframework.com/doc-2.0/guide-db-query-builder.html ..、 http://www.yiiframework.com/doc-2.0/guide-db-active-record.html – scaisEdge