Well, the problem is like a question. If the PHP program does not nest HTML code, it is a pure PHP program. It only processes data in the database or images, and does not nest html code, is the execution efficiency much higher? Here is a description: {code ...} {code ...} well, the problem is like a question. If the PHP program does not nest HTML code, it is a pure PHP program. It only processes data in the database or images, and does not nest html code, is the execution efficiency much higher?
Here is a description:
Yes. I will hand over rendering to the front end for processing. The backend php only provides services and transmits the data through JSON.
Here, I have answered my own question: I personally tested it. If php is just a pure operation and does not need to parse MVC, the efficiency will be higher, but it is not as high as we think, and there will be no saying that it is almost two or three times as high as we think. However, completely separating the front and back ends is particularly beneficial to development.
Reply content:
Well, the problem is like a question. If the PHP program does not nest HTML code, it is a pure PHP program. It only processes data in the database or images, and does not nest html code, is the execution efficiency much higher?
Here is a description:
Yes. I will hand over rendering to the front end for processing. The backend php only provides services and transmits the data through JSON.
Here, I have answered my own question: I personally tested it. If php is just a pure operation and does not need to parse MVC, the efficiency will be higher, but it is not as high as we think, and there will be no saying that it is almost two or three times as high as we think. However, completely separating the front and back ends is particularly beneficial to development.
What you call HTML Rendering is that php reads html template files or text strings and outputs them after processing.
What you call "only processing database data or image processing without nesting html code" may be omitted. Since there are omitted steps, the efficiency will definitely increase.
Of course, you replace the html Assembly step with the json Assembly step. Make sure that the performance of this step is no worse than before.
However, if the image data is not well designed, an http request will be sent one more time. If the design is poor, the speed may deteriorate.
HTML Rendering is not required, and the performance is certainly a little higher.
But are you sure you can "not render HTML?
The subject wants to completely separate the front and back ends? If yes, you can optimize the php server to improve efficiency.
Not high. php itself is a template written in c. The biggest advantage lies in nested html pure cpu computing, task scheduling, and io processing, which are all disadvantages of php.
The problem is whether it takes a long time to render the page or a long time to process the database.
This... this is not the legendMVC
Design Patterns!
Control LayerAndModel Layer,View LayerSeparated. The Controller is equivalent to an interface. It retrieves the corresponding model layer for data processing based on the data in the view layer!
Model LayerResponsibleBusiness Logic Operation
,Control LayerResponsibleAllocate tasks and output data to the view layer
, Plusopcode
Cache,memcache
,redis
Cache, my God!It's about to go.
~