Today I started to bring two interns to php (2)

Source: Internet
Author: User
Today, I started to take two interns for php (2). today I started to take two interns for the php (1) framework. I thought it was too junk, so I wrote another one. The first is index. php, the entry to the project. Index. php? & Lt ;? Php $ url = 'app/login/Controller/LoginController. php? M = bring two interns to php today (2)

Today, I started to take two interns to the php (1) framework. I thought it was too spam, so I wrote another one.

The first is index. php, the entry to the project.

Index. php

?

       
       

? You can see this php jump from the code「 App/login/Controller/LoginController. php? M = init 」Url

Let's take a look.LoginController. Php

?

 Assign (FORM, $ form); $ smarty-> display ('View/login/login.htm ');} /*** start the zookeeper Upload operation */public function start () {// your zookeeper transaction has been taken into consideration $ form = parent :: post2Form (APP_LOGIN); // The Service returns the response parent: doService (APP_LOGIN, METHOD_START, $ form, false); // smarty returns the response $ smarty = parent:: getSmarty (); $ smarty-> assign (FORM, $ form); $ smarty-> display ('View/login/login.htm ');}} // Controller has been released successfully when zookeeper has been added $ loginController = new LoginCo Ntroller; // The Primary primary Primary

? There are many methods using the parent class in this code. let's look at the parent class again.

?

BaseController. php

 Template_dir = TEMPLATE_DIR; $ smarty-> compile_dir = COMPILE_DIR; $ smarty-> config_dir = CONFIG_DIR; $ smarty-> cache_dir = CACHE_DIR; $ smarty-> left_delimiter = delimiter; $ smarty-> right_delimiter = RIGHT_DELIMITER; // Please specify your desired region name when setting your region $ smarty-> assign (P_NAME, P_NAME_VAL); return $ smarty ;} /*** REQUEST_URI contains invalid response when getting response */public function getMethod () {$ uri = $ _ SERVER ['request _ URI ']; // uri outer empty outer if (! StringUtils: isEmpty ($ uri) {$ arrUrl = parse_url ($ _ SERVER ['request _ URI ']); // The parameter name in the uri sets the parameter field if (! StringUtils: isEmpty ($ uri) {$ arrParams = null; parse_str ($ arrUrl ['query'], $ arrParams); return $ arrParams ['M']; // in uri, the specified parameter name is used to set the parameter field combination} else {return METHOD_INIT;} // uri specified empty parameter combination} else {return METHOD_INIT ;}} /***** $ _ POST contains invalid parameter TerraForm without missing parameter */public function post2Form ($ name) {require_once (APP_PATH. $ name. '/form /'. $ name. 'form. php '); $ formName = $ name. 'form'; // initial Form Transition: TerraForm $ form = new $ formName; // form のすべての class_var_arr = get_class_vars (get_class ($ form); foreach ($ class_var_arr as $ name =>$ value) {if (! StringUtils: isEmpty (@ $ _ POST [$ name]) {$ form-> $ name =@ _ POST [$ name] ;}} return $ form ;} /***** $ _ GET contains invalid parameter TerraForm when generating invalid parameter values */public function get2Form (& $ form) {// form extends when the number of bytes exceeds the upper limit gets the upper limit $ class_var_arr = get_class_vars (get_class ($ form); foreach ($ class_var_arr as $ name => $ value) {if (! StringUtils: isEmpty (@ $ _ GET [$ name]) {$ form-> $ name =@ _ GET [$ name] ;}} /*** the Service calls outbound callback ** @ param String $ name: the host name * @ param String $ methodName: calls outbound callback when there are too many outgoing neighbors * @ param object $ form has been created successfully * @ param boolean $ isOpenTrans true: when there are too many required parameter values required false: when there are too many required parameter values required when loading required */public function doService ($ name, $ methodName, & $ form, $ isOpenTrans) {require_once (APP_PATH. $ name. '/service /'. $ name. 'service. php ');// TODO $ isOpenTrans $ serviceName = $ name. 'service'; $ Service = new $ serviceName; $ service-> $ methodName ($ form); // TODO $ isOpenTrans}?>

? Constant file

?

Const. php

?

 

? Tool file:

?

StringUtils. php

?

 

?

?

? Html code

Login.htm

Zookeeper

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.