我正在使用laravel 4,我们有自己的rest API,我无法使用GET使用laravel获取数据。
如果我把网址放在浏览器中,我可以看到所有信息。例如:
http://myroutedotcom/v1/categories?entity_id=1&category_id=1
现在在laravel中,在视图中,我有这个代码并返回404:
$parameters = array (
'category_id' => 1,
'entity_id' =>1
);
$request = Request::create('/v1/categories', 'GET', $parameters);
$response = json_decode(Route::dispatch($request)->getContent());
var_dump($response);
欢迎任何贡献!
答案 0 :(得分:2)
$parameters = array (
'entity_id' =>$city_id,
'category_id' =>$category_id
);
$request = Request::create('/v1/places', 'GET', $parameters);
Request::replace($request->input());
$data_places = json_decode(Route::dispatch($request)->getContent());
关键在于这一行: 请求::替换($请求 - >输入());