Finally out of the army, starting today, to learn thinkphp, commemorate.
1. Introduction
Thinkphp is a free, open-source, fast, simple object-oriented, lightweight PHP development framework that follows the Apache2 Open source protocol and is created for Agile Web application development and simplified enterprise application development.
2. Basic Concepts
LAMP
Lamp is an open source network development platform based on Linux,apache,mysql and PHP. Linux is an open system; Apache is the most common Web server; MySQL is a relational database with Web-based management add-ons; PHP is a popular object scripting language.
OOP
OO programming (objectoriented Programming, OOP, object-oriented programming) is a computer programming architecture. One of the basic tenets of OOP is that a computer program is composed of a single unit or object that can act as a subroutine. OOP achieves the three main goals of software engineering: reusability, flexibility, and extensibility.
MVC
MVC is a design pattern that makes it mandatory to separate the input, processing, and output of an application. Using an MVC application is divided into three core parts: model (M), view (V), CONTROLLER (C), each of which handles its own tasks.
views : A view is an interface that the user sees and interacts with. One big benefit of MVC is that it can handle many different views of your application. There is really no real processing happening in the view, whether the data is stored online or an employee list, as a view, it is simply a way to output data and allow the user to manipulate it.
model : Models represent enterprise data and business rules. Of the three parts of MVC , the model has the most processing tasks. The data returned by the model is neutral, meaning that the model is independent of the data format, so that a model can provide data for multiple views. Because the code applied to the model can be reused by multiple views only once, it reduces the repetition of the code.
Controller : The controller accepts the user's input and invokes the model and view to complete the user's needs.
Now we summarize the process of MVC, first the controller receives the user's request and decides which model should be called to process it, then the model uses the business logic to process the user's request and return the data, and finally the controller formats the data returned by the model with the corresponding view and renders it to the user through the presentation layer.
ORM
Object-Relational mapping (object/relation Mapping, or ORM) is a result of the development of object-oriented software development methods. The object-oriented development method is the mainstream development method in the enterprise application development environment, and the relational database is the mainstream data storage system which is stored permanently in the enterprise-level application environment. object and relational data are two representations of business entities, and business entities behave as objects in memory and behave as relational data in the database. There are associations and inheritance relationships between objects in memory, and in a database, relational data cannot directly express many-to-many associations and inheritance relationships. Therefore, object-relational mapping (ORM) system usually exists in the form of middleware, which mainly realizes the mapping of program object to relational database data.
AOP
AOP (aspect-oriented programming, aspect-oriented programming) can be said to complement and improve OOP (object-oriented programing, object-oriented programming).
Curd
Curd is a database technology abbreviation, the general project development of various parameters of the basic functions are curd. It represents the creation(create), update, read (read), and remove (delete) operations.
ActiveRecord
Active record (Chinese name: Activity Records) is a domain model pattern, characterized by a model class corresponding to a table in the relational database, and one instance of the model class corresponding to a row of records in the table. The Active record is very similar to row Gateway (row record entry), but the former is a domain model and the latter is a data source schema. Relational databases often express entity relationships through foreign keys, and the active Record also maps this relationship as an object's association and aggregation at the data source level. The Active Record is suitable for very simple domain requirements, especially where the domain model and database model are very similar. If a more complex domain model structure is encountered (for example, with inheritance, the domain model of the policy), it is often necessary to use the domain model of the detached data source, combined with data Mapper.
The active record driver framework generally has the functionality of the ORM framework, but the active record is not a simple ORM, as is the difference from the Row Gateway. Originally proposed by rails, it follows the standard ORM Model: Tables map to records, records are mapped to objects, fields are mapped to object properties. Together with the naming and configuration conventions followed, the operation of the model can be implemented very quickly and is simple and understandable.
Single entry
A single entry usually refers to a project or application that has a uniform (but not necessarily unique) entry file, which means that all the functionality of the project is done through the portal file, and often the entry file is executed in the first step.
The benefit of a single entry is the overall comparison specification of the project, since the same entry often has the same rules between its different operations. Another aspect is that the advantage of single entry is that control is more flexible, because interception is convenient, similar to some rights control, user login aspects of the judgment and operation can be unified processing.
3. License Agreement
thinkphp Follow Apache2 Open Source Agreement published. Apache licence is the protocol used by the famous non-profit open source organization Apache. The agreement is similar to BSD, encouraging code sharing and respecting the copyright of the original author, as well as allowing code modifications to be released as Open source or commercial software . Conditions that need to be met:
1. Need to give code to the user a copy of Apache Licence;
2. If you modify the code, you need to explain it in the modified file;
3. In the extended code (modified and in the code derived from the source code) need to have the original code of the Agreement, trademark, patent Declaration and other original author required to include the instructions;
4. If the rereleased product contains a notice file, the Apache Licence is required in the notice file. You can add your own permission to the notice, but you may not be able to make changes to Apache licence.
4. Directory structure
thinkphp.php
|
Frame Entry File |
Common
|
Framework Common Files Directory
|
Conf
|
Framework configuration file Directory |
| Lang |
Framework System Language Directory |
| Lib |
System core base Class Library Directory |
Tpl
|
System Templates Directory |
thinkphp Study Notes (i)