2016-09-08 9 views
0

私はyiiフレームワークで作業しています。 1つのプロジェクト名 "yii"を作成しました。私はまた、1つの画面を配置していた1、私はCDbConnection.connectionStringを空にすることはできません

yii/demo/first/ 
       ->protected->config->main.php 
       ->controller->SiteController.php 
       ->view->site->view.php 

を作成したフォルダ内の他の第1

      yii/demo/first 

をしてデモフォルダを持っているプロジェクトで は

...上記表示するように
ショット

メインファイルでは、スクリーンショットに示すように接続文字列を配置しました

enter image description here

私も、私はこのサイトを実行すると、まだ私は

enter image description here

のようなエラーが出るのmysql

に「学生」としてデータベース名を作成していた私はまだそのエラーを示す接続文字列を配置していました。私に教えてください上記のコード内の任意のミスの場合

..

答えて

0

あなたはcomponents内部main.phpファイルにこのコードを試してみてください。

保護/設定/ main.php

'components' => array(
    'db'=>array(
     // Add hostname, port number, dbnanme 
     'connectionString' => 'mysql:host=hostname;port=5432;dbname=dname', 
     'emulatePrepare' => true, 
     'username'   => "username", // Add db Username 
     'password'   => "password", // Add Db Password 
     'charset'   => 'utf8', 
     'schemaCachingDuration' => 3600, 
), 
), 
関連する問題