標題說話自己。因此,這裏是我的項目結構: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
讓我爲你投票:) –