Home >Backend Development >PHP Tutorial >Is ThinkPHP a software framework?
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.
Recommended courses: PHP Tutorial.
ThinkPHP is a fast, compatible and simple lightweight domestic PHP development framework. It was born in early 2006, formerly known as FCS, and was officially launched on New Year's Day in 2007. It was renamed ThinkPHP and released under the Apache2 open source protocol. It was transplanted from the Struts structure and improved and perfected. It also drew on many excellent foreign frameworks and models, used object-oriented development structures and MVC models, and integrated Struts ideas and TagLib (tag library), RoR's ORM mapping and ActiveRecord mode.
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.
Important concepts
To master ThinkPHP, you must first understand several important concepts. For friends who are familiar with Java development, it should be easy to understand the following concepts .
Action object
is similar to the Action of the Struts framework. The Action object mainly provides control and processing of application logic and belongs to the control layer of ThinkPHP. The core App class completes the analysis of modules and operations. Directly transferred to the corresponding Action object for processing. All Action objects in the application class inherit the system's Action base class.
Dao object
refers to DataAccessObject (data access object). The Dao design pattern separates the underlying data access logic and business logic, sandwiching it between the business layer and the data layer for database access. and operations. Can operate on single table and multiple tables. The Dao objects in ThinkPHP are transactional objects built on the abstract database access layer.
VO object
refers to ValueObject (data object), more precisely, it is a business object, because the VO object lives in the business layer and is used by business logic. There is a mapping relationship between the VO object and the data table. Each attribute of the VO object corresponds to a field of the data table (or view). You can add VO object attributes of other non-data table fields for business logic operations, such as Related fields. The VO object has a special reserved attribute _info, which is an array variable used to save some special information of the VO object. The concept corresponding to the VO object is PO (persistent data object). The concepts of VO and PO come from O/RMapping (ObjectRelationalMapping, object relational mapping). PO can only be used in the data layer (that is to say, the attributes of the PO object must corresponds to the data table one-to-one), VO is used in the business logic layer and presentation layer (can have its own additional attributes). Each layer operates its own data objects, which reduces the coupling between layers and facilitates future system maintenance and expansion. If PO is used in each layer, it is equivalent to using global variables. We know that the use of global variables is strongly discouraged in OO design.
VoList Object
In the ThinkPHP framework, the queried data set (ResultSet) is converted into a data list object, that is, the VOLIST object. The difference from the ResultSet object is that each record is equivalent to to a VO object. VO objects can be easily traversed and manipulated in the VOLIST object. Both VO objects and VOLIST objects belong to entity objects in the ThinkPHP framework and are basic elements of data operations. If you do not use Dao mode during the development process, but directly operate the database through the database driver class, then the ResultSet object will be returned. The ThinkPHP system provides methods for converting ResultSet objects into VOLIST objects.
Component and plug-in support
Role-based permission control system
Enterprise-level applications are inseparable from security protection. ThinkPHP uses the Spring-based Acegi security system as a reference Prototyped and simplified to fit the current ThinkPHP structure, it provides a multi-layered, customizable security system to provide security control for application development. The security system mainly includes: security interceptor, authentication manager, decision-making access manager, and running identity manager.
The above is the detailed content of Is ThinkPHP a software framework?. For more information, please follow other related articles on the PHP Chinese website!