2017-05-28 8 views
0

MacOSではxamppを使用してlocalhostサイトにGoogleアナリティクスAPIを実装しようとしています。Google api php client

が、イムは、このエラーを取得:

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

@OluwafemiSule :)? – Mosh

答えて

0

Composerを使用してライブラリをインストールした場合、それはvendorにインストールされ、Composerが生成するautoload.phpで利用可能になります。

私はrequire_once DIR. '/vendor/autoload.php';index.php(推奨)に、またはGoogleClientクラスをインスタンス化する必要がある場合はこれを行います。

あなたがそうのような認証設定を設定すると、クライアントの資格情報へのパスが正しく参照されていることを確認します。 Google_Client->setAuthConfig($pathToCredentials)

参考: https://github.com/google/google-api-php-client#authentication-with-oauth

  • オートローディングクラス:AUTH認証情報の設定

  • +0

    素晴らしい!ありがとう! – Mosh

    関連する問題