标题说明了自己.所以这是我的项目结构:
原文链接:https://www.f2er.com/php/138563.html|src |Database |Core |MysqL.PHP |Support start.PHP |vendor composer.json index.PHP
<?PHP namespace Database\Core; //Some methods here
//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 }
问题出在哪儿?我真的厌倦了试图应对这种情况.请帮帮我们!谢谢.