1

を使用してgeocoder-php composer パッケージをインストールしましたphp composer.phar install。私はPHPフレームワークLaravelで実行しています。

Loading composer repositories with package information
Installing dependencies
  - Installing willdurand/geocoder (1.0.10)
    Downloading: 100%

  - Installing kriswallsmith/buzz (v0.7)
    Downloading: 100%

willdurand/geocoder suggests installing guzzle/guzzle (Enabling Guzzle allows you to use the GuzzleHttpAdapter.)
willdurand/geocoder suggests installing zendframework/zend-http (Enabling Zend_Http allows you to use the ZendHttpAdapter)
Writing lock file
Generating autoload files

パス.php

// --------------------------------------------------------------
// The path to the composer vendors directory.
// --------------------------------------------------------------
$paths['composer'] = 'vendor';

public/index.php

// --------------------------------------------------------------
// Autoload composer vendors.
// --------------------------------------------------------------
require path('composer').DS.'autoload.php';

composer.json

{
    "require": {
        "willdurand/geocoder": "@stable",
        "kriswallsmith/buzz": "@stable"
    }
}

問題: Geocoder-php のホームページで例を実行しようとすると、次のエラーが発生します。

エラー:

Class 'Geocoder\HttpAdapter\BuzzHttpAdapter' not found

発生場所:

$adapter  = new \Geocoder\HttpAdapter\BuzzHttpAdapter();

ディレクトリ構造

ここに画像の説明を入力

すでに Buzz をインストールしています。

4

1 に答える 1

1

機能する前にオートローダーを要求する必要があります

以下を追加してみてください:

require 'vendor/willdurand/Geocoder/autoload.php';
于 2012-09-23T23:48:52.303 に答える