[Mr. mai] Differences between Laravel framework and ThinkPHP (1). laravelthinkphp_PHP tutorial

Source: Internet
Author: User
[Mr. mai] What is the difference between Laravel framework and ThinkPHP? (1) laravelthinkphp. [Mr. mai] What is the difference between Laravel framework and ThinkPHP? (1) laravelthinkphp is a beginner in PHP. during the learning process, I found the difference between Laravel framework and TP framework, because of the difference between the Laravel framework and ThinkPHP framework of the time [Mr. mai] (1), laravelthinkphp

As a beginner in PHP Laravel framework, I found the difference between it and the TP framework during the learning process. due to time issues and lack of knowledge, I should first write out some of them, there is something wrong with it. I hope you guys can make it right...

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.

    

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.