/*class Ren { public $name; public $sex; function __construct($n,$s) { $this->name=$n; $this->sex = $s; } function __clone() { $this->name = "李四"; //this代表的是复本对象 //$that->name = "lisi"; //that代表原本,后来废弃了 } } $r = new Ren("张三","男"); //克隆 $r1 = clone $r; var_dump($r); var_dump($r1); */ //引用类,加载类 //关于根路径:php里面/代表根路径:指该文件所在的磁盘比如:D:/ //html里面/代表根路径:指服务器文件夹:www //include("/wamp/www/0607/Ren.class.php"); //include "Ren.class.php"; //require("Ren.class.php"); //require "Ren.class.php"; //require_once("Ren.class.php"); //require_once "Ren.class.php"; //自动加载类 //1.所有的类文件命名要求使用同一个规则 //2.文件名里面必须有类名 //3.所有类文件必须在同一个文件夹下 /*function __autoload($classname) { require $classname.".class.php"; } $r = new Ren(); echo $r->name;*/