Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
谷歌日历API-PHP-“谷歌日历”;类别';apiClient';“未找到”;_Php_Api_Calendar_Google Calendar Api_Google Api Php Client - Fatal编程技术网

谷歌日历API-PHP-“谷歌日历”;类别';apiClient';“未找到”;

谷歌日历API-PHP-“谷歌日历”;类别';apiClient';“未找到”;,php,api,calendar,google-calendar-api,google-api-php-client,Php,Api,Calendar,Google Calendar Api,Google Api Php Client,我正在尝试设置一个连接到Google日历API的应用程序 到目前为止,我已经: 添加了客户端库并将src文件夹移动到我的工作目录中 使用Google开发者控制台中的所有相关信息更新了Config.php文件 使用下面的代码在该文件夹中设置index.php文件,只运行该文件,我希望这会生成OAuth屏幕以登录,但是我的日志中会出现一个空白屏幕和一个错误 Class'apiClient'未找到… Index.php <?php set_include_path('src');

我正在尝试设置一个连接到Google日历API的应用程序

到目前为止,我已经:

  • 添加了客户端库并将src文件夹移动到我的工作目录中
  • 使用Google开发者控制台中的所有相关信息更新了Config.php文件
  • 使用下面的代码在该文件夹中设置index.php文件,只运行该文件,我希望这会生成OAuth屏幕以登录,但是我的日志中会出现一个空白屏幕和一个错误
Class'apiClient'未找到…

Index.php

<?php
    set_include_path('src');
    require_once "Google/Client.php";
    require_once "Google/Service/Calendar.php";

    $apiClient = new apiClient();   <---LINE CAUSING THE ERROR
    $apiClient->setUseObjects(true);
    $service = new apiCalendarService($apiClient);

    if (isset($_SESSION['oauth_access_token'])) {
        $apiClient->setAccessToken($_SESSION['oauth_access_token']);
    } else {
        $token = $apiClient->authenticate();
        $_SESSION['oauth_access_token'] = $token;
    }      
?>  

我也发现了这个问题。发生的事情是,他们更新了api,但没有更新文档。尝试将包含更改为

$g_Client = new Google_Client();
$g_Cal = new Google_CalendarService($g_Client);

本例使用Google Analytics API,但它可能会帮助您获得Oauth流。如果你仍然不能让它工作,让我知道,我会看看我是否可以做一个日历教程