Where does thinkphp read the database configuration information in the Conf/conf. php file?

Source: Internet
Author: User
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 );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.