错误:__autoload() 已弃用,请改用 spl_autoload_register()

时间:2021-02-10 22:35:03

标签: php config

Estou enfrentando um errro de PHP no servidor ao vivo。 Eu acredito que é um problema de versão。

O erro está incluído abaixo e ocorre no arquivo config.inc.php:

function __autoload($Class)

{

$cDir = ['Conn', 'Helpers', 'Models'];
$iDir = null;

foreach ($cDir as $dirName) :
    if (!$iDir && file_exists(__DIR__ . DIRECTORY_SEPARATOR . $dirName . DIRECTORY_SEPARATOR . $Class . '.class.php') && !is_dir(__DIR__ . DIRECTORY_SEPARATOR . $dirName . DIRECTORY_SEPARATOR . $Class . '.class.php')) :
        include_once(__DIR__ . DIRECTORY_SEPARATOR . $dirName . DIRECTORY_SEPARATOR . $Class . '.class.php');
        $iDir = true;
    endif;
endforeach;

if (!$iDir) :
    trigger_error("Não foi possível incluir {$Class}.class.php", E_USER_ERROR);
    die;
endif;

}

0 个答案:

没有答案
相关问题