Google지도가 올바르게 작동하도록 PHP 클라이언트를 가져오고 있습니다.Google지도 엔진 API Hello World MapItem을 찾지 못하는 PHP의 예
GitHub:https://github.com/google/google-api-php-client에서 GoogleAPI PHP 클라이언트의 로컬 사본을 다운로드했습니다.
IIS8에서 PHP v5.4를 실행 중입니다. GoogleAPI는 PHP 포함 폴더 GoogleAPI 아래에 설치되었습니다.
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 클래스를 확장합니다.
실행시 require_once ('MapsEngine.php') 행을 주석 처리 하시겠습니까? – jpatokal
예. AUTOLOADER가로드 중입니다. 필자는 오토로더가 호출 될 때 클래스 이름을 에코하여이를 확인했습니다. – Chann