Laravel - 亚马逊产品Api包无效

时间:2018-01-14 09:52:53

标签: php laravel api amazon

在Laravel中,我收到以下错误,

(1/1) ReflectionException
Class App\Http\Controllers\amazonApi does not exist

AmazonController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class AmazonController extends Controller
{
    public function amazonApi() {
        $product = Amazon::lookup('B004VLKY8M')->json();
        dd($product);
    }
}

web.php

Route::get('/', function () {
    return view('welcome');
});

Route::get('/api','amazonApi@AmazonController');

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

将路线更改为:

Route::get('/api', 'AmazonController@amazonApi');