您好我有一个简单的控制器,我想用暴食获取某个页面的内容,但我无法查看任何结果,因为我不断收到错误“NotFoundHttpException”Laravel没有找到HTTP异常
我的路线:
Route::get('hello', '[email protected]');
控制器:
function test(){
$client = new GuzzleHttp\Client();
$res = $client->get('https://api.github.com/user', ['auth' => ['user', 'pass']]);
echo $res->getStatusCode(); // 200
echo $res->getBody(); // { "type": "User", ....
return view('hello');
}
视图:
{!! $res !!}
你可以通过在浏览器中输入:http:// {url-name}/hello来访问这个'controller'吗? – eeya
http:// localhost/laravel/public/hello这是我输入的内容,并且我得到了nofoundhttp异常,但是如果我输入http:// localhost/laravel/public我会得到laravel主页 – Przemek
试试localhost/laravel/public/index.php /你好 – Imran