【问题标题】:Yii and Google Api PHP ClientYii 和 Google Api PHP 客户端
【发布时间】:2016-06-30 22:27:47
【问题描述】:

我需要将Google Api PHP Client 添加到我的 Yii 1.1 项目中。
我是 Yii 的新手,但我已经使用过这个库。
我怎样才能导入这个(没有作曲家)?

我会尝试将 google-api-php-client 放入 vendor 文件夹并添加这一行

Yii::import('application.vendor.*');
require_once('google-api-php-client/src/Google/Client.php');

但是当我使用时:

$client = new Google_Client();

我收到了这个错误:

include(Google_Config.php): failed to open stream: No such file or directory

我该如何解决?
谢谢。

【问题讨论】:

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


    【解决方案1】:

    正确的路径是

    Yii::import('application.vendor.*');
    require_once('google/apiclient/src/Google/Client.php');
    

    【讨论】:

      【解决方案2】:

      您应该始终使用__DIR__ 魔法常数。它允许您使用当前文件作为基本位置来处理文件。

      http://php.net/manual/en/language.constants.predefined.php

      这很可能是您遇到的问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-09-23
        • 2016-12-03
        • 1970-01-01
        • 2016-02-26
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多