我正在尝试让 Google Map 的 PHP 客户端正常工作。
我已经从 GitHub 下载了 GoogleAPI PHP 客户端的本地副本:https://github.com/google/google-api-php-client。
我在 IIS8 上运行 PHP v5.4。GoogleAPI 安装在 GoogleAPI 下的 PHP Include 文件夹中。
PHP 可以与我的所有其他脚本一起正常工作。
我正在尝试从Maps-Engine Documentation获取示例。
<?php
ini_set('display_errors','on');
require('GoogleAPI/autoload.php');
//require_once 'GoogleAPI/src/Google/Client.php';
//require_once 'Google/Service/MapsEngine.php';
$apiKey = "API Key";
$client = new Google_Client();
$client->setApplicationName("Google-PhpMapsEngineSample/1.0");
$client->setDeveloperKey($apiKey);
$service = new Google_Service_MapsEngine($client);
$optParams = array('maxResults' => 500, 'version' => 'published');
$results = $service->tables_features->listTablesFeatures("12421761926155747447-06672618218968397709", $optParams);
print_r($results);
?>
我收到的输出是:
Fatal error: Class 'Google_Service_MapsEngine_MapItem' not found in C:\Program Files (x86)\PHP\v5.4\includes\GoogleAPI\src\Google\Service\MapsEngine.php on line 4702
MapsEngine:4702 扩展了 Google_Service_MapsEngine_MapItem 类。Google_Service_MapsEngine_MapItem 类扩展了 Model.php 文件中定义的 Google_Model 类。