自动加载作曲家可以找到类
我正在尝试初学者课程PHP。我有一个关于与作曲家自动建立的问题。 class'app \ email'
我的目录结构
autoloading
-app
Email.php
Person.php
-src
-composer.json
-index.php
我有致命的错误:未被发现的错误:在index.php
require_once "vendor/autoload.php";
$email = new app\Email();
$person = new app\Person();
和composer.json中的
"autoload": {
"psr-4": {
"Dung6\\Autoloading\\": "src/",
"App\\": "app/"
}
},
在“ app \\”中的 :“ app/”
我在每次更改时都尝试。但是什么都没有用。有人可以为我检查。谢谢你!
I was try on a beginners course php. I had a issue about autouploading with composer. I had Fatal error: Uncaught Error: Class 'app\Email' not found in...
My directory structure looks like this
autoloading
-app
Email.php
Person.php
-src
-composer.json
-index.php
in index.php
require_once "vendor/autoload.php";
$email = new app\Email();
$person = new app\Person();
And in composer.json had
"autoload": {
"psr-4": {
"Dung6\\Autoloading\\": "src/",
"App\\": "app/"
}
},
in "App\\": "app/"
I was try ./app, /app/,... and I was composer dump-autoload every time I change. But nothing work at all. Some one can check it for me. Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论