魔术函数,自动加载机制
function __autoload($class_name) {   //自动传递的是类名
$path = str_replace('_', '/', $class_name);
require_once $path . '.php';
}
// 这里会自动加载Http/File/Interface.php 文件
$a = new Face();

 

当实例化类时就会加载相应的类文件

 

相关文章:

  • 2021-05-19
  • 2021-07-09
  • 2021-05-24
  • 2022-12-23
  • 2021-11-05
  • 2022-02-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-08
  • 2022-12-23
  • 2022-12-23
  • 2021-07-22
  • 2021-06-19
相关资源
相似解决方案