Brief Introduction: This is a detailed page for coherent operation analysis. It introduces related knowledge, skills, experiences, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 337543 'rolling = 'no'> basic idea: Save the content to be operated using the _ call method of PHP and execute the last step.
Knowing this idea will soon be able to build suchProgram:
<? Phpclass test {protected $ Options = array (); public function _ call ($ method, $ ARGs) {If (in_array ($ method, array ('where ', 'data', 'add') {$ this-> options [] = $ ARGs [0];} else {echo 'method you are operating on '. $ method. 'nonexistent ';}} public function display () {return $ this-> options ;}}$ test = new test (); $ result = $ test-> where ('a = 1, B = 2')-> display (); var_dump ($ result);?>
Output result:
Return to the thinkphp source code, and find that every time the method is executed, there will be a sentence: return $ this;
Returning the object itself is a crucial step in a coherent operation. After returning the object itself, the execution method will not fail to be found when performing the next operation.
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/337543.html pageno: 9.