似乎无法正确安装google-api-php-client

时间:2016-02-03 13:53:43

标签: php google-app-engine google-api-php-client google-contacts

google api php客户端出现问题。即使我按照github上的安装确切地说它仍然无法正常工作。我没有使用Composer方式,但我下载了该版本。我试图在response-callback.php require_once中使用不同的路径,如

public class ModuleAModule : ModuleBase, IModule
{
    private readonly IRegionManager _regionManager;
    private readonly IUnityContainer _container;

    public ModuleAModule(IUnityContainer container, IRegionManager regionManager)
        : base(container, regionManager)
    {
        _regionManager = regionManager;
        _container = container;
    }

    protected override void InitializeModule()
    {            
        RegionManager.RegisterViewWithRegion(RegionNames.TheWholeRegion, typeof(LoginControl));
    }

    protected override void RegisterTypes()
    {
        Container.RegisterType<IViewModel, MyViewModel>();
        Container.RegisterTypeForNavigation<MySuperControl>();            
    }
}

但没有任何效果......

错误:

$('a.link').each(function()
{
    var anchor_url = $(this).attr("href");
    var product_val = '';

    if (-1 == anchor_url.indexOf('&product='))
    {
        if (-1 == anchor_url.indexOf('?product='))
            product_val = anchor_url.substr(anchor_url.indexOf('?product=')+'?product='.length);
    }
    else
        product_val = anchor_url.substr(anchor_url.indexOf('&product=')+'&product='.length);

    if (product_val.indexOf('&') != -1) product_val = product_val.substr(0, product_val.indexOf('&'))

    if (product_val == '') new_link = anchor_url+'&product='+getQueryVariable("product");
    else new_link = anchor_url.split(product_val).join(getQueryVariable("product"));

    $(this).attr("href",  new_link);
});

的app.yaml:

'google-api-php-client/src/google/autoload.php'
'google-api-php-client/vendor_autoload.php' 

main.php

Fatal error: require_once(): Failed opening required 'google-api-php-client/vendor/autoload.php' (include_path='.:/Users/mike/Documents/test:/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/php/sdk') in /Users/mike/Documents/test/response-callback.php on line 3
Warning: require_once(google-api-php-client/vendor/autoload.php): failed to open stream: No such file or directory in /Users/mike/Documents/test/response-callback.php on line 3

响应callback.php

application: csimporttest
version: 1
runtime: php55
api_version: 1

handlers:
- url: /.*
  script: main.php

1 个答案:

答案 0 :(得分:0)

将整个Google php客户端库放在项目文件夹中,然后更改

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

为:

require_once 'google-api-php-client-1-master/src/Google/autoload.php';