Home  >  Article  >  PHP Framework  >  thinkphp5 advantages and disadvantages

thinkphp5 advantages and disadvantages

angryTom
angryTomOriginal
2019-08-23 14:33:537125browse

thinkphp5 advantages and disadvantages

ThinkPHP was born to simplify enterprise-level application development and agile WEB application development. It was first born in early 2006, and was officially renamed ThinkPHP on New Year's Day 2007, and was released under the Apache2 open source agreement. ThinkPHP has been adhering to the simple and practical design principle since its birth. While maintaining excellent performance and minimal code, it also focuses on ease of use. And it has many original functions and features. With the active participation of the community team, it is continuously optimized and improved in terms of ease of use, scalability and performance. Below we summarize the shortcomings of thinkphp for everyone.

Recommended tutorial: Thinkphp video tutorial

##Advantages

  1. Easy to use, easy to configure and deploy

2. Compilation caching mechanism Conducive to performance improvement

3. Built-in support for REST

## MVC and OO I won’t say anything else...

Disadvantages

 1. Troublesome URL routing

Normal mode:

## URL -> ; URL routing-> Pass the parameters and requests parsed from the URL to the entry function

Implementation of TP (taking regular routing as an example):

  Regular-> Entry file dynamic parameters

##  For example: '/^blog\/(\d )$/' => 'Blog /read?id=:1'

##  Simple implementation:

## / ^blog\/(\d )$/' => read // function read($id) {...}

This implementation is easy to check The matching of routing rules and entry functions makes it more convenient for users to use the parsed URL parameters. At the same time, the design of TP's entry file is unnecessary.

 2. Poor model design

  *1 Need to manually build the model and database Association

Disadvantages: A series of unnecessary configurations are required, which is contrary to the behavior of automatically generating database tables after defining the model.

  *2 The abstraction of the database is far from enough

  There are many problems when operating the model It has a strong feeling of operating a database, and due to the shortcoming of 2*1 that you need to manually establish the association between the model and the database, the unnecessary field mapping is annoying.

 3. Garbage template engine

  *1 Template inheritance is not supported

Dear, it’s very tiring to write code repeatedly!

*2 Template tags in XML format

## It is inconvenient to write and easy to use with HTML Tag confusion (template engines that have appeared in recent years rarely use XML tags...)

##  *3 Not suitable for front-end writing

##     Template data-> Rendering output

##                                           wanted will should be placed in the background TP's template support for this is not good.

   *4 Partial caching of templates is not supported

##      Disadvantages: Assume that page P is It consists of two parts, A and B. The update frequency of A is greater than that of B, so the update frequency of page P is the same as A.

The above is the detailed content of thinkphp5 advantages and disadvantages. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn