Model
class classoneModel extends Model{ protected $trueTableName = ''; //前缀+表名; protected $dbName = 'ybdbcjd'; //库名,也可以从配置文件,或者 D() 参数设置;}
Controller:
public function select_(){ $use=D('classone','','mysql://root16656:@localhost/ybdbchfjhfjjds'); $db=$use->select(); echo '';print_r($db);echo '
';}public function select_(){ $use=D('classone','qqqqqqqqqqqqqqqqqqqqqq','mysql://root16656:@localhost/ybdbchfjhfjjds'); $db=$use->select(); echo '';print_r($db);echo '
';}
Controller This library name YBDBCHFJHFJJDS, is I change, supposedly, should be wrong, but incredibly successful! The data can be searched normally, so that the library is not covered, it is still the model library,
And the following example, prefix I wrote a qqqqqqqqqqqqq, I could not find the data,
When will this be overwritten, and when not to be overwritten?
Reply content:
Model
class classoneModel extends Model{ protected $trueTableName = ''; //前缀+表名; protected $dbName = 'ybdbcjd'; //库名,也可以从配置文件,或者 D() 参数设置;}
Controller:
public function select_(){ $use=D('classone','','mysql://root16656:@localhost/ybdbchfjhfjjds'); $db=$use->select(); echo '';print_r($db);echo '
';}public function select_(){ $use=D('classone','qqqqqqqqqqqqqqqqqqqqqq','mysql://root16656:@localhost/ybdbchfjhfjjds'); $db=$use->select(); echo '';print_r($db);echo '
';}
Controller This library name YBDBCHFJHFJJDS, is I change, supposedly, should be wrong, but incredibly successful! The data can be searched normally, so that the library is not covered, it is still the model library,
And the following example, prefix I wrote a qqqqqqqqqqqqq, I could not find the data,
When will this be overwritten, and when not to be overwritten?
Only two parameters for the D function the first parameter is the resource address, the second is the model layer name
You put the MySQL connection on the third null parameter, of course, it won't take effect.
The mysql link parameter is the third parameter inside the M function:
So no overlay does not cover one said