Where does thinkphp read Confconf. the database configuration information in the PHP file has been studied in the thinkphp framework for several days, but the database configuration information obtained during Database instantiation cannot be found. & nbsp; DB_TYPE & gt; mysql, & nbsp; DB_HOST & gt; localhost, & nbsp; DB_NAME & gt; where does thinkphp read Conf/conf. database configuration information in the PHP file
I have been studying the thinkphp framework for a few days, but I still cannot find the database configuration information obtained when instantiating the database.
'Db _ type' => 'mysql ',
'Db _ host' => 'localhost ',
'Db _ name' => 'examples ',
'Db _ user' => 'root ',
'Db _ pwd' => '123 ',
'Db _ port' => '123 ',
'Db _ prefix' => 'think _',
Then, return the database instantiation object
Expert analysis
------ Solution --------------------
When instantiating the Think class, call the C function in the Think: buildApp method to load
It is stored in the C function as a static variable.
------ Solution --------------------
$ User = new Model ("User"); // "User" is the name of the database table.
$ User = M ("User"); this is a simple method provided by thinkphp.
$ List = $ user-> select ();
Var_dump ($ list );
Configuration is
Config. inc. php file and
In the controller
$ Arrr = array (
'Dbms '=> 'mysqli', // note that the key name in the group in this book cannot be changed.
'Username' => 'Google ',
'Password' => 'hello ',
'Hostname' => '2017. 0.0.1 ',
'Database' => 'mydbname ',
);
$ Db = new Db ($ arrr );