【发布时间】:2015-06-24 15:18:53
【问题描述】:
我收到以下错误:
Class 'App\Http\Controllers\File' not found
在 laravel 5 控制器中使用时:
$files = File::files( $this->csvDir );
我必须将Filesystem 添加到composer.json 和config/app.php。不知何故,我使用了错误的配置。
这就是我改变的:
composer.json
"require": {
"laravel/framework": "5.0.*",
"illuminate/html": "5.*",
"illuminate/filesystem": "5.*" /* my try to repo */
},
配置/app.php
'providers' => [
// [...]
// jerik 2015-04-17: get html Forms
// http://laravel.io/forum/09-20-2014-html-form-class-not-found-in-laravel-5
'Illuminate\Html\HtmlServiceProvider',
'Illuminate\Filesystem\FilesystemServiceProvider', // try to add file
当我运行composer update 时,它运行良好,但没有输出文件系统已下载。所以我的配置是错误的,但我不知道正确的方法。
有什么建议或提示吗?
【问题讨论】:
-
代替
$files = File::files( $this->csvDir );试试$files = \File::files( $this->csvDir ); -
我认为你没有在 app.php 中添加 Facade
-
不应该是框架自带的吗?
标签: php laravel namespaces laravel-5 illuminate-container