2017-05-28 259 views
0

我想在Mac OS上使用xampp在localhost站點上實現google analytics API。Google api php客戶端

但是我得到這個錯誤:

Fatal error: Uncaught Exception: This library must be installed via composer or by downloading the full package. See the instructions at https://github.com/google/google-api-php-client#installation. in /Applications/XAMPP/xamppfiles/htdocs/ga-api/google-api-php-client/autoload.php:14 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/ga-api/index.php(4): require_once() #1 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/ga-api/google-api-php-client/autoload.php on line 14

誰能幫助我?

+0

您是否通過作曲家安裝? –

+0

是的,通過終端http://take.ms/Ey1SZ – Mosh

+0

@OwawafemiSule :)? – Mosh

回答

0

鑑於您使用Composer安裝了該庫,它將安裝到vendor,並將在Composer生成的autoload.php中提供。

我會require_once DIR. '/vendor/autoload.php';index.php(首選)或我需要實例化GoogleClient類。

確保客戶證書的路徑是正確地引用,當您設置身份驗證的配置,像這樣: Google_Client->setAuthConfig($pathToCredentials)

參考:

+0

太棒了!謝謝! – Mosh