Routes / web.php中的代码:
Route :: post('/ test',function(){ echo“testing”; die(); });
我的控制器中的代码:
$request_headers = array();
$request_headers[] = 'X-XSRF-TOKEN:'.Session::token();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, url('test'));
curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "name=test");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec ($ch);
curl_close ($ch);
var_dump($output);
输出返回带有消息的页面:“页面因不活动而过期”
有人请告诉我如何解决它