The standard independent group directory structure is (taking a Home group as an example):
--+ Home Home group directory
├-+ Common group function directory
├-+ Conf group configuration directory
├-+ Lang group language pack directory
├-+ Action group Action controller directory
├-+ Model group Model Model directory
├-+ Widget grouped Widget directory
├-+ ORG grouped extended class library directory
├-+ ... other hierarchical directories
└-+ Tpl grouped template directory
1. Output of ThinkPHP 3 (Key Points)
a. Output on the page through PHP’s native output methods such as echo
P B. Output through the Display methodIf you want to assign a variable, you can use the assign method
c. Modify the left and right delimiters
置 To modify the configuration item in the configuration file
'TMPL_L_DELIM'=>'<{', //Modify the left delimiter
'TMPL_R_DELIM'=>'}>', //Modify the right delimiter
2. Model usage of ThinkPHP 3 (Key points)
You need to operate the database in the form of new Model (table name) in the method
$m=new Model('User');
$arr=$m->select();
'DB_TYPE'=>'mysql', //Set the database type
'DB_HOST'=>'localhost',//Set the host
'DB_NAME'=>'thinkphp',//Set the database name
to out’s out's' out’s' out out’s'
' W 'db_pwd' = & gt; '', // Set passwordOr 'db_port' = & gt; '3306', // Set the port number
'DB_PREFIX'=>'tp_', //Set the table prefix
You can also use the DSN method for configuration
'DB_DSN'=>'mysql://root:@localhost:3306/thinkphp',//Use DSN method to configure database information
If both methods exist at the same time, the DSN method will take priority
There is also a simple and practical model method
M() is equivalent to new Model();
$m=M('User');
$arr=$m->select();
可以 Use the example of the model to operate the data. The operation of the operation is general
Add -C Create $m->add()
Delete -D Delete $m->delete()
being changed to -U Update $m->save()
Check -R Read $m->select()
3. Supplementary information (understanding)
a. The template can traverse the array
调 B. We can turn on the page_trace
1. Turn on the debugging function
out
2. We need to set up the configuration file and enable page trace
_ 'Show_page_trace' = & gt; true, // Open the page traceConfiguration:
'URL_PATHINFO_DEPR'=>'-',//Modify the delimiter of the URL
'TMPL_L_DELIM'=>'<{', //Modify the left delimiter
'TMPL_R_DELIM'=>'}>', //Modify the right delimiter
'DB_TYPE'=>'mysql', //Set the database type
'DB_HOST'=>'localhost',//Set the host
'DB_NAME'=>'thinkphp',//Set the database name
'DB_USER'=>'root', //Set username
'DB_PWD'=>'', //Set password
'DB_PORT'=>'3306', //Set the port number
'DB_PREFIX'=>'tp_', //Set table prefix
'DB_DSN'=>'mysql://root:@localhost:3306/thinkphp',//Use DSN method to configure database information
'SHOW_PAGE_TRACE'=>true,//Open page Trace http://w2ks.com/
The above introduces the [thinkphp] basic guide, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.