The thinkphp framework was previously written in summary. go to here! & Nbsp; TP is a good framework, lightweight, and easy to use for small and medium-sized projects, rapid development, but it is estimated that the use of large projects will not work. I took the time to read the zendframwork usage. its use of MVC is indeed richer than that of TP. thinkphp framework usage summary
Previously written, go here!
Because we need to develop projects, we can use TP to quickly build them. for small and medium-sized projects, TP is a good framework, lightweight, easy to use, and fast to develop, however, it is estimated that the use of large projects will not work. I also took the time to read the zend framwork usage. its MVC thinking is indeed richer than TP. after all, it is the best PHP framework in the world, very good. I will take the time to study it later, but it is estimated that the two are similar in learning. However, the running speed is still zend, and the engine of others is awesome.
The most impressive thing about TP is its association model. Database Association is an important concept in program development. it is generally the ID association between tables, if you use a traditional SQL language for association, JOIN ON, LEFT JOIN, or RIGHT JOIN is required, which increases the complexity of thinking. TP encapsulates the process in a modular manner, you only need to explicitly define some key attributes, for example:
For example, the userId of a table Profile must be associated with the id field of the Dept table.
The module is defined as follows:
Protected $ _ link = array ('dept' => array ('ing ing _ type' => BELONGS_TO, // ing type, here is the one-to-multiple relationship 'class _ name' => 'dept', // name of the data table to be associated (excluding the prefix) 'foreign _ key' => 'userid ', // The userId 'ing ing _ name' => 'dept' field to be associated with the id field in the Dept table in the Profile table, // ing name, that is, the association name to be used in the template // define more Association attributes ...... ),);
Put the above content into the ProfileModel to associate the Dept table. it is very simple and clear to use, and there are some other association attributes.
When using Association query in the controller, the following is shown:
$Profile=D('Profile');$data=$Profile->relation(true)->find(1);print_r($data);$Profile->display();
The running result is as follows:
Array ('id' => 1, 'account' => 'thinkphp', 'password' => '123 ', 'dept' => array ('email '=> 'GS @ 123.com', 'nickname' => 'champion xiu ',),)
If you add 'as _ fields '=> 'email, nickname' to the association attribute, the following result is returned:
Array ('id' => 1, 'account' => 'thinkphp', 'password' => 'name', 'Email '=> 'GS @ 123.com ', 'nickname' => 'champion Show ',)
This is just a place, and there are still a lot of sharp points that will not be listed one by one. for example, automatic verification and automatic completion of these powerful functions are indeed a good choice for rapid development and use of framework technology, modular things will save a lot of time and energy. for programming, it is essential to stand on the shoulders of giants, taking the length of hundreds of thousands is the final principle.