Explanatory PHP Framework (i) Basic concepts
LAMP
Lamp is an open source network development platform based on Linux,apache,mysql and PHP. The term comes from Europe, where these programs are often used as a standard development environment. The name comes from the first letter of each program. Each program complies with open source standards in ownership: 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, It contains the best features of most other languages to make its web development more effective. Developers using the tools in these Linux environments under the Windows operating system are called using Wamp.
While these open source programs themselves are not designed to work with several other programs themselves, they are often used together because they are large open source software and have many common features. The compatibility of these components has improved over the past few years, and the application situation has become more common. And they have created some extensions to improve collaboration among the different components. Currently, these products are included by default in almost all Linux distributions. Linux operating system, Apache server, MySQL database and Perl, PHP or Python language, these products together constitute a powerful Web application platform.
with the booming of the open source, the three pillars has been developed with the development of Java EE and. NET commercial software, and the software-developed project has a low cost of investment in software and is therefore of concern to the entire IT community. From the website traffic, more than 70% of the traffic is lamp to provide, lamp is the most powerful website solution.
OOP
Object-oriented programming (object Oriented Programming,oop, OO 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. To achieve the overall operation, each object can receive information, process data, and send information to other objects. OOP mainly has the following concepts and components:
components-data and functions in a running computer program formed in a unit, the component in the OOP computer program is a modular and structured basis.
Abstraction-The program has the ability to ignore certain aspects of the information being processed, namely the ability to focus on the main aspects of the information.
encapsulation-also known as information encapsulation: Ensure that components do not change the internal state of other components in an unpredictable way, and that only those components that provide an internal state change method can access their internal state. Each type of component provides an interface that is associated with other components and specifies the method by which other components are called.
Polymorphism -component references and class sets involve many other components of different types, and the result of referencing a component depends on the type of actual invocation.
inheritance-Allows child class components to be created on the basis of existing components, which unifies and enhances polymorphism and encapsulation. Typically, a class is used to group components, and it is possible to define a new class as an extension of an existing class, so that the class can be organized into a tree or mesh structure, which embodies the versatility of the action.
component-based programming has become particularly popular in scripting languages due to the reasons for abstraction, encapsulation, reusability, and ease of use.
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. For older Web applications, views are an interface of HTML elements, and in modern Web applications, HTML still plays an important role in the view, but new technologies are emerging, including Adobe Flash and Elephant xhtml,xml/xsl, Some identity languages and Web services, such as WML. How to handle an application's interface becomes increasingly challenging. 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. For example, it may use artifact objects such as EJBS and ColdFusion to process the database. 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. So when you click a hyperlink in a Web page and send an HTML form, the controller itself does not output anything and do any processing. It simply receives the request and decides which model component is called to process the request, and then determines which view to use to display the data returned by the model processing.
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.
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. Curd defines the basic atomic operations that are used to process data. The high level of curd to a technical challenge is due to the completion of an activity that involves a rollup of curd operations in multiple database systems, and its performance may vary greatly depending on the data relationship.
curd does not necessarily use the Create, update, read, and delete words in specific applications, but the functionality they perform is consistent. For example, thinkphp is a curd operation that uses the Add, save, select, and Delete methods to represent the model.
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.
or some people will worry about all the sites through a portal file access, whether it will cause too much pressure, in fact, this is a worrying idea.
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.
object-oriented is developed from the basic Principles of software engineering (such as coupling, aggregation, encapsulation), and the relational database is developed from the mathematical theory, and the two sets of theories have significant differences. In order to solve this mismatch, object-relational mapping technology emerged.