Home > Article > Backend Development > What does php smart mean?
php smart refers to the PHP Smarty template engine, which is one of the template engines written in PHP; it separates the logical code and external content, and provides an easy-to-manage and use method. Separate the logic of PHP code that was originally mixed with HTML code.
The operating environment of this tutorial: Windows 7 system, PHP version 7.1, DELL G3 computer.
php What does smart mean?
Smarty is a template engine written in PHP and is one of the most famous PHP template engines in the industry. It separates logical code and external content, providing an easy-to-manage and use method to separate PHP code logic that is originally mixed with HTML code.
To put it simply, the purpose is to separate PHP programmers from front-end personnel, so that programmers change the logical content of the program without affecting the page design of the front-end personnel, and front-end personnel re-modify the page without affecting the program. Program logic, which is particularly important in multi-person collaboration projects.
Advantages
1. Speed: Programs written using Smarty can achieve maximum speed improvements, which is compared to other template engine technologies.
2. Compiled type: A program written in Smarty needs to be compiled into a non-template technology PHP file at runtime. This file uses a mixture of PHP and HTML, and the WEB request will be sent directly the next time the template is accessed. Convert to this file without recompiling the template (when the source program has not been changed)
3. Caching technology: A caching technology selected by Smarty, which can store the content that the user finally sees. The HTML file is cached into a static HTML page. When Smarty's cache attribute is set to true, the user's WEB request is directly converted to this static HTML file within the cachetime set by Smarty. This is equivalent to calling a Static HTML files.
4. Plug-in technology: Smarty can customize plug-ins. Plug-ins are actually some custom functions.
5. If/elseif/else/endif can be used in templates. Using judgment statements in template files can very conveniently reformat the template.
Not suitable for using Smarty
Content that needs to be updated in real time. For example, like stock display, which needs to update data frequently, using smarty for this type of program will slow down template processing.
Small projects. For small projects where the artist and programmer are both simple because the project is simple, using Smarty will lose the advantage of PHP's rapid development to a certain extent.
(PS: However, for the sake of standardization of the entire project, please try to use the template engine. In fact, if you get used to it, the development speed will be faster. The above are the problems encountered by developers who are not used to the template engine)
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What does php smart mean?. For more information, please follow other related articles on the PHP Chinese website!