码迷,mamicode.com
首页 > Web开发 > 详细

phP多态

时间:2016-02-21 17:07:51      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5 <title>无标题文档</title>
 6 </head>
 7 
 8 <body>
 9 
10 <?php
11     
12     //include("../china.php");
13     //require_once "../China.php";
14     
15     
16     function __autoload($classname)
17     {
18         require_once $classname . ‘_class.php‘;
19     }
20     
21     
22     
23     $ren = new Ren();
24     $ren->name="张三";
25     $ren->Eat();
26     
27 
28 ?>
29 
30 </body>
31 </html>
 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5 <title>无标题文档</title>
 6 </head>
 7 
 8 <body>
 9 
10 <?php
11 
12     class Ren
13     {
14         var $name ;
15         var $age;
16         
17         function Eat()
18         {
19             echo "{$this->name}正在吃饭";
20         }
21         
22         function __clone()
23         {
24             $this->name = "李四";
25         }
26         
27     }
28     
29 
30 
31 ?>
32 
33 
34 </body>
35 </html>

 

phP多态

标签:

原文地址:http://www.cnblogs.com/sihuiming/p/5205175.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!