[Mr. mai] the difference between Laravel framework and ThinkPHP for Beginners (1)-I found the difference between Laravel framework and TP framework as a beginner in PHP, due to time issues and lack of knowledge, I would like to write out some of them first. if you have any mistakes, I hope you can make an ax...
1. different rendering templates: In the Laravel framework, return view () is used to render templates. in ThinkPHP, $ this-> display () is used to render templates;
2. in actual development, we often encounter this problem, that is, the development location is not fixed, which causes us to frequently change the database configuration, causing trouble for the development work, TP still does not avoid this "disaster"; in laravel framework ,. the emergence of the env environment file solves this problem. we only need to configure it in different work locations. configure the env file because it is git or svn ". env will not be submitted to the server along with the file ";
3. Laravel framework provides a large number of closures. as a Cainiao, I currently only use the use method, that is, how can I use outer variables inside a function?
4. note differences in post values: in the Laravel framework, cross-site attacks are taken into account. Therefore, if the form is used to transmit values in post mode, if {csrf_filed ()} is not added to the form, the TokenMethodnotfound syntax error is reported. The TP framework needs to manually complete the code to prevent cross-site attacks;
5. differences in the writing method of conditional judgment statements: In the Laravel framework, if else judgment statements and foreach statements must start with @ if and end with @ endif. if not, a syntax error is reported, @ foreach @ endforeach: Similarly, the TP framework is consistent with the usage of PHP syntax rules. The ifesle statement is used to judge and foreach loop traversal.