Or About The Database Problems, More Entanglements

Yii: : app () - > db represent what meaning, how to read? Is yii kind of static methods app ()?

App () method is described as follows:

Framework/YiiBase. Php# 134 (hide)

Public static function app ()


Return self: _app;


Return the application single example, if single cases haven’t create is null.

Specific what meaning be? On behalf of what?

  • > db is the presentation of a what do you mean

Because CDbConnection inherited from the CApplicationComponent, we can also use it as an application components use. (what is the as application components use?

To do so, please in application configuration equipped with a db (or other name)

Application components are as follows: array (… ‘components’ = > array (…

‘db’ = > array (’ class ‘= >’ CDbConnection ',

‘connectionString’ = > 'mysql: host = localhost; Dbname = testdb ',

‘username’ = > ‘root’, ‘password’ = > ‘password’, ’

EmulatePrepare '= > true,

) then we can through the Yii: : app () - > db access the database connection.

In the main, PHP defined in the db array. CDbConnection is how to read came in. (how to identify the db, then find out the db, the name of the user name and password. Use the code, the best what key can tell unship!

The database link this is really confused. To solve the problem, and then continue to look down. Otherwise, didn’t mind looking down the.

Whatever your native language is, use it instead of translators.