介面控制器
public function store(Request $request)
{
$statistics = Statistics::create($request->all());
return response()->json($statistics, 201);
}
route Route::get('statistics',[StatisticsController::class,'store']);
卷曲函式
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://localhost/kdk_local/statistics");
curl_setopt($ch, CURLOPT_POSTFIELDS,
"game_id=3&user_id=3&bet=3&win=3&session_id=3");
curl_exec($ch);
curl_close($ch);
uj5u.com熱心網友回復:
請清除路由快取:
php artisan route:clear
如果不起作用,請洗掉此檔案:
bootstrap/cache/routes-v7.php
或者
bootstrap/cache/routes.php
uj5u.com熱心網友回復:
在路由檔案中使其post來自get:
Route::post('statistics', [StatisticsController::class,'store']);
使用 API 路由 (
api.php) 進行外部 API 呼叫。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/321186.html
上一篇:使用curl將fly上傳到FastAPI端點-307臨時重定向
下一篇:從郵遞員那里提取卷曲不起作用
