2017-05-28 214 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