2014-11-06 67 views
2

的核心報告API官方教程告訴我們要包括兩個文件:在谷歌API PHP客戶端庫找不到Google_Client.php

require_once 'google-api-php-client/src/Google_Client.php'; 
require_once 'google-api-php-client/src/contrib/Google_AnalyticsService.php'; 

然而,正如我們可以在GitHub的頁面上看到(https://github.com/google/google-api-php-client) ,沒有Google_Client.php文件(實際上,我無法在文件夾內的任何地方找到它)。官方教程是過時還是什麼?我能做什麼?

+2

也許過時了,我給它一看,你應該載入autoloader.php''require_once「谷歌API的PHP客戶機/自動加載.php';'' – arma 2014-11-06 05:04:59

+0

@arma謝謝!不能相信混亂。 :( – dotslash 2014-11-06 05:09:37

回答

4

請嘗試以下代碼,Pleae包括autoload.php文件...

require_once 'google-api-php-client/autoload.php'; 

    $client = new Google_Client(); 

    $client->setApplicationName("Client_Library_Examples"); 

    $client->setDeveloperKey("YOUR_APP_KEY"); 

    $service = new Google_Service_Books($client); 
+0

雖然我試圖使用OAuth,但autoload.php已經解決了我現在的問題。 – dotslash 2014-11-06 06:42:43

相關問題