Ucenter source code -- index. php

Source: Internet
Author: User
Ucenter source code -- index. php 1: After ucenter is installed, enter Ucenter. if you enter the ucenter domain name in the address bar of the browser, the index is loaded by default. php. if the domain name is not input with any parameters, it will jump to the admin in the root directory. php. We can see the code

$ M and $ a are parameters received by index. php and admin. php. $ M code indicates the class to be instantiated, and $ a code indicates the method to be called. for example, $ m = user, $ a = login. the/control/user will be loaded. php, $ m = new usercontrol (), $ m-> onlogin ();

The next step is to introduce the files under the release model. if there are any files under the/release/model, the files under the/model will be preferentially introduced.

,

If your $ m and $ a exist, the following code will be used for dynamic calls. From the code, we can see that m only has the following types: app, frame, and user, all of which correspond to several files under this/control.

Then load the corresponding control file to obtain the class name and then instantiate the class. before calling the method, first determine whether the class has the function, and first call $ method = on. $ a method. if it does not exist, use _ call ($ method) to call it;

From the figure below, we can see that m can be converted into the following objects. The value of $ a is implemented for the methods below the change class. We can perform a small test. $ m = app, $ a = add. the test result is shown in the picture on the right. for why-1 is returned, see/control/app. the onadd () method under php.

Index. processing of addslash functions after php is a security measure. it is generally used to handle changes above PHP6. because php6 has abandoned MAGIC_QUOTES_GPC, the server will not, $ _ GET, $ COOKIE. escape the data from these clients. In this way, you need to use addslashes to manually escape them, so that the special characters of single quotation marks, double quotation marks, and/will not cause SQL injection problems.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.