我在Laravel Request函数上遇到一些问题。
当我添加到函数index(Request $request)
时,出现类似
ErrorException: Declaration of App\Http\Controllers\AliExpress::index() should be compatible with App\Http\Controllers\ScraperController::index(Illuminate\Http\Request $request) in file C:\Users\Rade\Desktop\AGAIN\jwt\app\Http\Controllers\AliExpress.php on line 123
我的代码如下所示。当我删除(请求$ request)并在代码中手动设置$ url和$ product_url时,它工作正常,当我返回$ url或$ product_url时,工作正常,但我丢失了什么,那是什么?
class ScraperController extends Controller
{
public function index(Request $request){
$url = $request->url;
$product_url = $request->product_url;
$getProduct = new AliExpress($url, $product_url);
return $getProduct->index();
}
}