2016-06-07

【程式』Laravel : 使用 Guzzle 時,出現錯誤 Class 'App\Http\Controllers\GuzzleHttp\Client' not found



最近開始看 Laravel ,想說好像有點紅。
因為之後會有 cURL 的需求,
所以就找了個套件 Guzzle 來用 然後我在使用 Guzzle 時,居然一直出現錯誤
Class 'App\Http\Controllers\GuzzleHttp\Client' not found
Google 好久,終於找到解法:
If you place use GuzzleHttp\Client; at the top of your file, then that will make Client available in your script.

If you wanted to use the full namespace in your script, then you would need to prefix it with a backslash, otherwise PHP will think you’re trying to specify a relative namespace

在這裡記錄一下。


0 comments:

張貼留言