无法在yii中集成Google Calendar API

时间:2015-01-14 11:39:04

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

我想将Google Calender API与我的yii应用程序集成。

我遵循PHP的this link步骤:

  • 我添加了google库文件夹作为组件
  • src
  • 中包含了库config/main.php文件夹的路径
  • 使用autoload.php添加了require_once文件。

当我尝试运行它时,我收到错误

  

include(Google_Client.php):无法打开流:没有此类文件或目录。

Isn&#t; t autoload.php文件是否应包含Google图书馆所需的所有文件?但不知怎的,它没有发生。知道为什么吗?

1 个答案:

答案 0 :(得分:0)

解决!这是自动加载的问题。我取消注册yii的自动加载然后调用库自动加载,然后重新注册yii autoload。它奏效了。

我添加了这些行来修复它:

spl_autoload_unregister(array('YiiBase','autoload'));
require_once realpath('/path/to/google/autoload.php');
spl_autoload_register(array('YiiBase','autoload'));