自动加载文件laravel 4失败
我需要一个快速的帮助。 自动加载我的类时,会抛出一个错误:自动加载文件laravel 4失败,laravel,autoload,Laravel,Autoload,我需要一个快速的帮助。 自动加载我的类时,会抛出一个错误: Class 'Applicant\Respository\ApplicantInterface' does not exist 我已经尝试并查找了一些关于自动加载的文章,包括但仍然没有运气。这是我的密码: 树形结构 resultchecker +app +Applicant +Helper +Provider +Repository +Eloquent -Appl
Class 'Applicant\Respository\ApplicantInterface' does not exist
我已经尝试并查找了一些关于自动加载的文章,包括但仍然没有运气。这是我的密码:
树形结构
resultchecker
+app
+Applicant
+Helper
+Provider
+Repository
+Eloquent
-Applicant.php
-ApplicantInterface.php
applicationInterface.php
namespace Applicant\Repository;
interface ApplicantInterface {
public function all();
public function get();
public function lookup();
}
HomeController.php
use Applicant\Respository\ApplicantInterface;
class HomeController extends BaseController {
public function __construct(ApplicantInterface $applicantRepo)
{
$this->applicantRepo = $applicantRepo;
}
public function home()
{
return View::make('app.index');
}
composer.json
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
],
"files" : [
"app/Applicant/Helper/functions.php"
],
"psr-0" : {
"Applicant" : "app/"
}
},
我在这里做错了什么?看起来像是您的
应用程序接口。php
不在存储库
目录中,因此您必须移动它,使您的结构如下所示:
resultchecker
-app
-Applicant
-Helper
-Provider
-Repository
-Eloquent
Applicant.php
ApplicantInterface.php
如果不起作用,请尝试运行php artisan dump autoload
我还建议您从psr-0
切换到psr-4
自动加载:
"psr-4": {
"Applicant\\": "app/Applicant"
}
祝你好运