Пример #1
0
<?php

header('Content-Type:text/html;charset=utf-8');
//include('./25.php');或require此时可能出现不同人多次include同一个文件
//once可以解决上面的问题但是once效率很低
//  function __autoload($c){
//     require('./'.$c.'.php');
// }
spl_autoload_register('zdjz');
function zdjz($c)
{
    require './' . $c . '.php';
}
$m = new Human();
$m->t();
// function test() {
//     class Bird {
//         public static function sing() {
//             echo "百灵鸟放声歌唱";
//         }
//     }
// }
// //Bird::sing();//Class 'Bird' not found因为没有调用test()函数
// test();
// Bird::sing();