嗨伙计们,你能帮我下一步吗?
我有下一个代码
索引.php
set_include_path(get_include_path()
.PATH_SEPARATOR.'application/controllers'
.PATH_SEPARATOR.'application/models'
.PATH_SEPARATOR.'application/views');
spl_autoload_register();
$front = new Controller;
$front->route();
控制器.php
public function route(){
if(class_exists($this->getController())){...}......
我有一个办法。Insted 使用spl_autoload_register();
I can write
function __autoload($classname) {
@include_once $classname.'.php';
}
但是根据 php 文档,我想使用 spl_autoload_register... 如果您需要完整的代码,我很乐意演示它。
谢谢!