Introduction. I checked the code today and flew all the way to the database.
<span>1</span><span>$this->slave()->select('sina_user_id, sina_nickname, password')->from(self::Table_User_Info)</span>
Obviously the table .user_info has been determined here;
This file is not loaded->database();
As the name: slave() is from Library, trace slave(). Sure enough, the library name string is combined here,
<span>1</span><span> public function slave($dbName = 'default') </span><span>2</span> { <span>3</span> }
func. Inside load->database();
Check database() in loader; there is the following sentence,
<span>1</span><span><strong>require</strong>_once(BASEPATH.'database/DB.php');</span>
Find DB.php;
<span>1</span><span> if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = BASEPATH.'config/'.ENVIRONMENT.'/database.php'))</span>
The introduction of multiple database attributes in this file, see core file analysis for details.
Finally found the location of database.php
<span> 1</span><span>// Default DB Config </span><span> 2</span><span>$db['default_master']['hostname'] = 'localhost'; </span><span> 3</span><span>$db['default_master']['username'] = 'admin'; </span><span> 4</span><span>$db['default_master']['password'] = '12345678'; </span><span> 5</span><span>$db['default_master']['database'] = ' '; </span><span> 6</span><span>$db['default_master']['port'] = 3306; </span><span> 7</span><span>$db['default_master']['dbdriver'] = 'mysql'; </span><span> 8</span><span>$db['default_master']['pconnect'] = FALSE; </span><span> 9</span><span>$db['default_master']['db_debug'] = TRUE; </span><span>10</span><span>$db['default_master']['cache_on'] = FALSE; </span><span>11</span><span>$db['default_master']['cachedir'] = ''; </span><span>12</span><span>$db['default_master']['char_set'] = 'utf8'; </span><span>13</span><span>$db['default_master']['dbcollat'] = 'utf8_general_ci'; </span><span>14</span><span>$db['default_master']['swap_pre'] = ''; </span><span>15</span><span>$db['default_master']['autoinit'] = TRUE; </span><span>16</span><span>$db['default_master']['stricton'] = FALSE;</span>
Tracing the database is completed.
The above introduces a simple database tracing, including the require content. I hope it will be helpful to friends who are interested in PHP tutorials.