【问题标题】:Google Calendar API - PHP - "Class 'apiClient' not found"Google 日历 API - PHP - “找不到类 'apiClient'”
【发布时间】:2014-10-01 10:58:23
【问题描述】:

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

到目前为止我有:

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

Class 'apiClient' not found...

索引.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;
    }      
?>  

【问题讨论】:

  • 此示例使用 Google Analytics API,但它可能会帮助您降低 Oauth 流程。如果你仍然不能让它工作,请告诉我,我会看看我是否可以制作日历教程daimto.com/google-oauth2-php

标签: php api calendar google-calendar-api google-api-php-client


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-02-21
    • 1970-01-01
    • 2017-11-01
    • 1970-01-01
    • 2011-04-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多