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.