Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.0k views
in Technique[技术] by (71.8m points)

php - Autoload spl_autoload_register

I'm trying to autoload my classes, but I keep getting

Fatal error: Uncaught Error: Class "Database" not found in C:xampphtdocslogapp equire.php:9 Stack trace: #0 C:xampphtdocslogpublicinicheader.php(15): require_once() #1 C:xampphtdocslogindex.php(3): include('C:xampphtdocs...') #2 {main} thrown in C:xampphtdocslogapp equire.php on line 9

  spl_autoload_register(function($class){
(__FILE__) . DIRECTORY_SEPARATOR . str_replace('\', DIRECTORY_SEPARATOR , strtolower($class)) . '.php';});
 
$db = new Database();
$core = new Core();

The repo: https://github.com/Saboor-Hamedi/blog1.git

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...