Home> PHP Framework> ThinkPHP> body text

what are thinkphp and smarty

青灯夜游
Release: 2022-06-14 17:56:01
Original
2312 people have browsed it

thinkphp is an open source lightweight PHP framework that is used to simplify enterprise application development and agile WEB application development; using ThinkPHP, developers can develop and deploy applications more conveniently and quickly. Smarty is a PHP template engine that can better help developers separate program logic and page display (separation of business logic and display logic), so that programmers can change the logic content of the program without affecting the page design of the front-end staff, and the front-end staff can re- Modifying the page will not affect the program logic of the program.

what are thinkphp and smarty

The operating environment of this tutorial: Windows7 system, thinkphp6&&smarty4 version, Dell G3 computer.

What is thinkphp

ThinkPHP is an open source lightweight PHP framework that was born to simplify enterprise application development and agile WEB application development. .

was first born in early 2006. It 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.

ThinkPHP is a fast, compatible and simple lightweight domestic PHP development framework. It was born in early 2006. It was originally named FCS. It was officially renamed ThinkPHP on New Year's Day in 2007. It is released under the Apache2 open source agreement and transplanted from the Struts structure. It has made improvements and improvements, and also borrowed many excellent foreign frameworks and models, using object-oriented development structure and MVC model, integrating the ideas of Struts and TagLib (tag library), RoR's ORM mapping and ActiveRecord model.

ThinkPHP can support server environments such as windows/Unix/Linux. The official version requires PHP5.0 or above. It supports MySql, PgSQL, Sqlite databases and PDO extensions. The ThinkPHP framework itself has no special module requirements. The specific application system operating environment requirements depend on the modules involved in development.

As an overall development solution, ThinkPHP can solve most needs in application development, because it includes the underlying architecture, compatibility processing, base class library, database access layer, template engine, caching mechanism, and plug-ins Mechanism, role authentication, form processing and other commonly used components, and it is more convenient for cross-version, cross-platform and cross-database transplantation. And each component is carefully designed and perfected, and the application development process only needs to focus on your business logic.

Advantages:

1. Easy to use, rich Chinese documentation;

2. Low learning cost, high community activity;

3. The framework has strong compatibility, PHP4 and PHP5 are fully compatible, and fully supports UTF8, etc.

4. Suitable for the development of small and medium-sized projects.

5. Fully conforms to the MVC framework concept of modern PHP;

6. Combined with Thinkphp's database framework ORM, as long as you understand TP, there is no sense of violation when using our framework.

Disadvantages:

1. The support for Ajax is not very good;

2. The directory structure is messy and takes time to sort out;

3. It is easy to get started, but difficult to learn in depth.

What is smarty

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.

Smarty can better help developers separate program logic and page display. For example, in a project where the front and back ends are separated, and the front and back ends are different developers, Smarty can do this without affecting each other. Under the circumstances, the front-end and back-end collaboration can be perfectly realized. And the separation of business logic and display logic is a design concept of Smarty.

Simply put, 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 the front-end personnel re-modify it The page will not affect the program logic of the program, which is particularly important in multi-person collaboration projects.

Some features of Smart

  • are very fast.

  • is much more efficient than embedding PHP into HTML.

  • is much more efficient than embedding PHP into HTML.

  • No template parsing overhead, only compiled once.

  • Smartly recompiles template files only if they have been modified.

  • You can easily create your own function and variable decorators, which is very extensible.

  • Configurable template delimiter syntax {delimiter}, you can use {$foo}, {{$foo}},