我目前已在我的应用程序目录中为所有“库”添加了一个新文件夹。我不断收到找不到该类的错误,这就是我所做的:
我已将其添加到composer.json 文件中的自动加载值中:
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php",
"app/services",
"app/facades",
"app/libraries" --> here
]
},
将其添加到类加载器中的 global.php 文件中:
ClassLoader::addDirectories(array(
app_path().'/commands',
app_path().'/controllers',
app_path().'/models',
app_path().'/database/seeds',
app_path().'/libraries', --> here
));
在 app.php 中为其创建一个别名:
'aliases' => array(
'App' => 'Illuminate\Support\Facades\App',
'Session' => 'Illuminate\Support\Facades\Session',
...
'SimpleImage' => 'App\Libraries\abeautifulsite\SimpleImage', --> here
),
并在我的控制器中调用该类:
$img = new SimpleImage($file);
我不断收到的错误是找不到该类。我缺少什么?
ErrorException (E_UNKNOWN)
Class 'App\Libraries\abeautifulsite\SimpleImage' not found
(PS。我在终端中做了composer dump-autoload)