标题说话自己。因此,这里是我的项目结构:PHP Composer自动加载器类没有发现异常
|src
|Database
|Core
|MySQL.php
|Support
start.php
|vendor
composer.json
index.php
MySQL.php文件:
<?php
namespace Database\Core;
//Some methods here
的index.php和start.php文件:
//start.php file
<?php
require __DIR__ . '/../vendor/autoload.php';
?>
//index.php file
<?php
use Database\Core;
require __DIR__ . '/src/start.php';
$mysql = new MySQL(); // Gets exception Class 'MySQL' cannot found etc.
?>
最后我composer.json自动加载部分:
"autoload": {
"psr-4": "Database\\": "src/" // Also tried "src/Database" too
}
问题在哪里?我非常厌倦尝试应对这种情况。请帮助家伙!谢谢。
谢谢我真的很感激,但不能投票,由于低信誉:) – lostbyte
让我为你投票:) –