【发布时间】:2014-04-27 16:09:40
【问题描述】:
在我的 Laravel 应用程序中,我在应用程序目录中创建了 Acme\fooDir 目录
我正在尝试从 fooDir 中调用模型 -“barModel”
//app/Acme/fooDir/test.php
$barM = new barModel;
但我收到此错误
Class 'Acme\fooDir\barModel' not found
这是我的应用结构
app
-app/Acme
--app/Acme/fooDir
---app/Acme/fooDir/test.php (this is the file that could load the barModel)
-app/models
--app/model/barModel.php (this is the model i am trying to use)
我在 composer.json 中添加了自动加载
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
],
"psr-0":
{
"Acme": "app/"
}
和 我已经运行了命令
composer dump-autoload -o
和
php artisan dump-autoload
但问题没有解决,我仍然遇到同样的错误
Class 'Acme\fooDir\barModel' not found
有什么想法吗?
【问题讨论】:
标签: php laravel laravel-4 composer-php