The basic information found on the Internet is the same as that written in Documents: document. thinkphp. cnm... {code ...} however, when I use M ()-& amp; gt; table (& quot; tp_user)-& amp; gt; select ();, an error is returned, the SQL statement in the error message contains the table prefix in the configuration file... the basic information found on the Internet is the same as that in the document:
Http://document.thinkphp1.cn/m...
For example, $ Model-> table ('think _ user')-> where ('status> 1')-> select (); you can also specify a database in the table method, example: $ Model-> table ('Db _ name. think_user ')-> where ('status> 1')-> select (); the table name specified by the table method must be complete, however, the following method can be used to simplify the import of data table prefixes, for example: $ Model-> table ('_ USER _')-> where ('status> 1 ') -> select (); the data table prefix corresponding to the current model is automatically obtained to generate the think_user data table name.
However
M ()-> table ("tp_user)-> select ();
An error is reported. the SQL statement in the error message contains the table prefix in the configuration file. However, when using the table method, do you need to add the table prefix yourself? Why does it read the prefix in the configuration file after I add a prefix?
In addition, is it necessary to use M ()-> table ("_ USER _") in actual development?
Isn't this easier to write? --> M ("User ")
Reply content:
The basic information found on the Internet is the same as that in the document:
Http://document.thinkphp1.cn/m...
For example, $ Model-> table ('think _ user')-> where ('status> 1')-> select (); you can also specify a database in the table method, example: $ Model-> table ('Db _ name. think_user ')-> where ('status> 1')-> select (); the table name specified by the table method must be complete, however, the following method can be used to simplify the import of data table prefixes, for example: $ Model-> table ('_ USER _')-> where ('status> 1 ') -> select (); the data table prefix corresponding to the current model is automatically obtained to generate the think_user data table name.
However
M ()-> table ("tp_user)-> select ();
An error is reported. the SQL statement in the error message contains the table prefix in the configuration file. However, when using the table method, do you need to add the table prefix yourself? Why does it read the prefix in the configuration file after I add a prefix?
In addition, is it necessary to use M ()-> table ("_ USER _") in actual development?
Isn't this easier to write? --> M ("User ")