我是laravel的新手,我正在开发一个文件上传系统。文件上传并存储到数据库就好了,但是当我尝试调用delete方法时,它会出现这个错误:
调用未定义的函数App \ Http \ Controllers \ riderect()
这是FileUpload Controller及其删除方法:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Redirect;
use App\UploadedFile;
class FilesController extends Controller
{
public function deleteFile($id)
{
$file = UploadedFile::find($id);
Storage::delete(config('app.fileDestinationPath').'/'.$file->filename);
return riderect()->to('uploaded');
}
}
如何避免这种错误?
答案 0 :(得分:2)
这是一个拼写错误,这个:
return riderect()->to('uploaded');
应该是:
return redirect()->to('uploaded');
答案 1 :(得分:1)
将riderect()->to('uploaded');
替换为redirect()->to('uploaded');