Cloudinary正在变得未定义。我正在使用laravel 10和“cloudinary-labs/cloudinary-laravel”:“^2.0”,
我已经安装了cloudinary bycomposer require cloudinary-labs/cloudinary-laravel
并发布云配置
php artisan vendor:publish --provider="CloudinaryLabs\CloudinaryLaravel\CloudinaryServiceProvider"
并在config/api.php中添加
'providers' => [
...
CloudinaryLabs\CloudinaryLaravel\CloudinaryServiceProvider::class,
],
'aliases' => [
...
'Cloudinary' => CloudinaryLabs\CloudinaryLaravel\Facades\Cloudinary::class,
],
还提供了我的API密钥,云名称在.env文件中。
这是我的控制器
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use CloudinaryLabs\CloudinaryLaravel\Facades\Cloudinary;
class FileUploadController extends Controller
{
public function storeUploads(Request $request)
{
$image = $request->file('image');
if($image){
$cloudinary = new Cloudinary();
}
}
}
这里是我得到未定义的Cloudinary
1条答案
按热度按时间yvgpqqbh1#
我解决了这个问题。我的问题是该高速缓存。当我重新启动IDE时,它正在工作。