1. Object-oriented syntax requires a summary of the details of the comparison "to the object-oriented after the completion of the basic grammar review"
2.ecshop do e-commerce website "Simulate this framework" install ecshop in the upload package "configuration: note GD and MySQL"
After successful installation, Ecshop is not compatible with more than php-5.4 version, error too much
"What needs to be considered now is to do a system implementation," "In addition to the reference to multiple frameworks and projects (two development of molded systems) to understand the business and ideas."
"Focus" 3. Design a framework "MVC framework Thinking"
(1) The first idea in frame design first realizes the separation of logic and display "because PHP itself is an embedded language, the first aspect of MVC is used when separating logic and display (separation between view and controller)" But now it seems Smarty has no advantage: because it is embedded in the Smarty code, and embedded in the PHP code is no different "" to separate the logic and view files, access to each other can only use the inclusion, Instead of accessing the request directly (separating the different business processing files in the framework and placing them in different folders so that they cannot be viewed directly through the path) "" The first entry of the company is under the Web, and then in the Web Index, the method under the specified class is introduced. Implement access control for controllers and methods, ensuring that the external HTTP is not accessed directly through the path (this is the focus of the framework design) "
(2) Separation of logic codes and models "separation between controller and model" puts the data and the basic processing of the data in the model, and the controller is primarily responsible for linking the data to the view. The company divides the processing layer into components and then uses the components (compentent.php) Call the database or XML interface processing method, implement the Data processing Layer "Controller processing HTTP request URL, and then according to the parameters in the URL to access the specified compentent file, to achieve the data targeted search, and then the resulting data, Assign to the view file. Complete the Complete business logic
The above realizes the framework thinking of MVC separation.
MVC Project Layering: (1) The implementation part of the specific business logic "is the concrete operation of the data" model (2) The implementation part of the display style. Html+css+js. Called View (3) is responsible for the overall process Control "starting from the request", responsible for invoking model and view, called Controller
4. "Model" is divided into different classes for different data "layers of the library". Model class, the model class needs to construct a common method in the implementation model of a base class, and then make all other model classes inherit the base class.
In the example, the sub-model class inherits the model base class from the model base class by calling the MySQLdb class for connection initialization "This is a singleton," which returns the connection object to a property in the model base class using the properties in the base class to perform database operations in the child model class " Method used is also the method in the MySQLdb class "", essentially the principle of using the base class to do a layer of intermediate class, the implementation of public methods "
"In a project in the company, a base class is constructed for each separate business. The controller.php and compentent.php in the controller are the base classes that "initialize the public members of the separate business in the base class" subclass inheritance, directly implementing the initialization work "
5. Controller Handling "Controller key is the processing of the entrance!! "Converts the user's request URL to a call to a specified method on the controller" This is the key to the entry on the controller. "
"The company realizes the entrance" "The company realizes the URL transforms the method of the controller and the action" "The Key" The company uses the index.php implementation of the Web to obtain the URL, and then, depending on the URL, instance a Font object, using the Dispatch method in the font to implement forwarding (the method to implement the introduction of the controller and the use of the controller call the specified method) "
"Problem" test "load test is the ability to improve now" "How to simulate concurrent tests such as Apache AB"
"Emphasis" on the understanding errors in the database connection in a single case before "" PHP connection with MySQL error: http://www.nowamagic.net/librarys/veda/detail/95 "" MySQL can limit the number of connections to the same user, and can limit the maximum number of connections directly. MySQL's connection is equivalent to interprocess communication, or remote access is also accessed. And the TCP connection is no different, is also a request and the corresponding process "" to PHP as a module of Apache has a more in-depth understanding of the "" Summary of MySQL: http://fengshuohlc.blog.163.com/blog/static /173470504201010283810655/"
Solving the separation problem of MVC with the company's framework, "the portal of the company and the solution of the routing distribution function (URL to controller and method use)"