![](/img/trans.png)
[英]Class 'App\Http\Controllers\Excel' not found in Laravel
[英]Laravel 5 Class 'App\Http\Controllers\File' not found
我收到以下錯誤:
Class 'App\Http\Controllers\File' not found
當在laravel 5控制器中使用時:
$files = File::files( $this->csvDir );
我要補充的文件系統來composer.json
和config/app.php
。 不知怎的,我使用了錯誤的配置。
這就是我改變的:
"require": {
"laravel/framework": "5.0.*",
"illuminate/html": "5.*",
"illuminate/filesystem": "5.*" /* my try to repo */
},
'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
,它運行良好,但沒有輸出Filesystem的下載。 所以我的配置錯了,但我不知道正確的方法。
有什么建議或提示嗎?
首先,您應該考慮使用內置存儲外觀。 除非您使用S3或Rackspace,否則不需要手動包含Filesystem
,因為默認情況下它已經包含在內 - 請參閱Laravel 5文檔中的Filesystem 。
看來,你應該導入File
,試試吧
use File;
或\\File
來解決問題,因為現在您正在使用來自當前命名空間的文件,並且可能未在App\\Http\\Controllers
命名空間中定義File
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.