user.php
实例
<?php namespace controller\user; class user { public function demo() { return __CLASS__.'加载成功'; } }
运行实例 »
点击 "运行实例" 按钮查看在线实例
demo1.php
实例
<?php namespace app; use controller\user\user; spl_autoload_register(function ($classname) { $classname = str_replace('\\','/',$classname); require __DIR__.'/'.$classname.'.php'; }); echo (new user)->demo();
运行实例 »
点击 "运行实例" 按钮查看在线实例