In the normal work of the use of the thinkphp framework, in the process of working with the YII framework and Laravel framework, in order to allow themselves to better understand the PHP framework, here I summed up the four main development of PHP common framework of the difference between the comparison.
First, the PHP CI framework
The CI framework is a simple and fast PHP MVC lightweight framework that performs efficiently, quickly and concisely, with less code, suitable for small to medium-sized projects, or large projects, but not very well-scaled.
Advantages: The framework is relatively simple, suitable for the introduction of development, easy to learn, quick to use, static easy, the document is more detailed.
disadvantage: because the frame is small, so the function is not complete, such as using MongoDB to implement the interface itself, the operation of the database is not secure (write operation). Support for large projects is not good.
Development work Flow:
1, index.php as the front-end controller, initialize the basic resources needed to run the CodeIgniter.
2. Router check the HTTP request to determine who will handle the request.
3. If the cache file exists, it will bypass the usual order of system execution and be sent directly to the browser.
4. Safety (security). Before the application controller (Applicationcontroller) is loaded, the HTTP request and any user-submitted data will be filtered.
5, controller load model, core library, plug-in, auxiliary function, and any other resources required to process a particular request.
6. Final view renders the content that is sent to the Web browser. If the cache is turned on (Caching), the view is first cached, so it will be available for future requests.
URL pattern for CI:
The URL pattern supported by CI defaults to the PathInfo form, which is used/separated. Where the//localhost/citest/index.php/is fixed, the entry file is indicated
Example://localhost/citest/index.php/hello/index
Second, thinkphp framework
The TP framework is a fast and easy-to-use, lightweight, native PHP development framework that uses object-oriented architecture and MVC patterns for development. It can support Windows, Linux and other servers, and support MySQL, SQLite and many other databases and PDO extension. It contains common components such as the underlying architecture, compatible processing, base class library, database access layer, template engine, caching mechanism, plug-in mechanism, role authentication, form processing, and more convenient for cross-version, cross-platform and cross-database porting. Suitable for small to medium project development.
Advantages: easy to use (Model,controller,view is responsible for their own work), it has the support of XML tag library technology of the compiled template engine, support two template tags, dynamic compilation, caching technology. also supports custom tag libraries, with unique data validation and AutoFill, MD5 data encryption and other functions. Simple deployment requires only one entry file to get started.
disadvantage: The template is relatively fixed, resulting in the idea of easy curing.
The TP Framework provides 4 types of routing, where rewrite routing needs to be modified in addition to the configuration can be used, configuration method see https://www.cnblogs.com/lovele-/p/9256575.html
1, get route form;
URL/index.php?m= Group &c= controller &a= method (the form of the book the lowest transmission mode, unsafe).
2, PathInfo route form "Default route form":
URL/index.php/Group/controller/method
3, rewrite route form;
URLs/groupings/controllers/methods
4. Compatible Routing form:
URL/index.php?s=/Group/controller/method
Third, PHP laravel framework
Laravel is a simple, elegant PHP Web development framework. The collection of new PHP features, as well as a variety of design patterns, is a suitable framework for learning, but requires a solid basic PHP proficiency. For the development of large and medium-sized projects.
Advantage:
1, support composer
2, the frame structure is clear, pay attention to the modularization of code (abstract middleware, tasks, services, etc.) and scalability, routing system quickly and efficiently
3, support processing cross-site request forgery, in the form of form post submission, must pass in {{Csrf_field ()}}
4, Laravel community is very powerful, with a wealth of expansion packages and tools
5, with caching, authentication, task automation, hash encryption, transactions and other functions
6. env environment file, which facilitates the configuration of the system and the development of different platforms.
Cons: a component-based framework that is relatively bloated
Laravel Routing method: Laravel has a powerful routing capability, including
1, the basic route route::get ('/', function () {return ' HelloWorld ';});
2, with the parameter route route::get (' User/{id} ', function ($id) {return ' user '. $id;});
3, route filter parameter Route::get (' User/{id}/{name} ', function ($id, $name) {//}), where (array (' id ' = ' = ' [0-9]+ ', ' name ' = ' = ' [ A-z]+ '));
4, sub-domain Routing and so on and so on
5, controller routing, such as some of the following styles
Route::resource (' article ', ' Articlecontroller '); RESTful way (specifically including get/post, etc.) Route::controller (' article ', ' Articlecontroller '); RESTful way (specifically including get/post, etc.) route::get (' User/login ', ' usercontroller@login ');//non-restful way get Route::p ost (' user/i ', ' Usercontroller@login ');//non-restful mode post
Iv. PHP Yii Framework
Yii Framework is a component-based, high-performance PHP open-source framework for large-scale web application development, and is one of the most efficient PHP frameworks available today. Suitable for large-scale web application development.
Advantage:
1, pure OOP development, easy to use model
2, Support command line tool development, can quickly create a Web application code
3. Highly reusable and scalable
4. Fast development speed, excellent performance and rich function
5. Support Composer Package management tools
Cons : The model layer is less considered and the document has fewer Chinese documents. Requires a level of proficiency in PHP technology, OOP programming is also very skilled