PHP-based loading operations and other two magic methods of the application instance, magic application instance
The instance is as follows:
<? Php loading class // include (". /Ren. class. php "); // include ". /Ren. class. php "; include_once (". /Ren. class. php "); include_once (". /Ren. class. php "); $ f = new Ren (); $ f-> test (); require (". /Ren. class. php "); require_once (". /Ren. class. php "); require_once ". /Ren. class. php "; $ f = new Ren (); $ f-> test (); automatically loaded class // 1. all class file names and class names must be consistent // 2. put all class files under the same file // 3. all class file naming rules are consistent function _ autoload ($ cname) {require_once (". /$ cname. class. php ");} $ t = new t Est (); $ t-> ceshi (). '<br>'; $ s = new Ren (); $ s-> test (); Two magic methods: class Ren {public $ name; public function say () {echo "method of output object";} // method of output object public function _ tostring () {echo "another method of output "; // echo $ s->__ tostring (); return "Another output method"; // echo $ s ;} // Method for object cloning public function _ clone () {$ this-> name = "Riven"; // $ this indicates a duplicate (cloned object )}} $ s = new Ren (); // echo $ s->__ tostring (); // output string // $ s-> say (); $ s-> name = "Small V"; var_dump ($ s ); $ S1 = clone $ s; var_dump ($ s1);?>
The above PHP-based loading operations and the application examples of the other two magic methods are all the content shared by xiaobian. I hope you can give me a reference, we also hope that you can support the customer's home.