index.php
<?php // require ‘Test1.php‘; // require ‘Test2.php‘; new Test2(); function __autoload($class) { require __DIR__.‘/‘.$class.‘.php‘; echo($class); } ?>
Test2.php
<?php // namespace Test2; class Test2 { public function __construct() { echo __FILE__; } public function __destruct() { echo ‘结束了‘; } } ?>
php解释index.php的输出结果是
问:
为什么echo($class)先执行?
时间: 2024-11-01 14:10:42