0

I'm just getting started with Zend Framework. I decided to try it for my website translations.

I set the include path as follow:

set_include_path('.:/usr/share/php:/usr/share/php/Zend/library');

And then straight from the docs this doesn't work:

use Zend\I18n\Translator\Translator;
$translator = new Translator();

Of course, I haven't loaded the Zend\I18n\Translator\Translator class anywhere, so I get:

Fatal error: Class 'Zend\I18n\Translator\Translator' not found in /path/file.php on line X

I see there are several things in the Zend/Loader directory, but I can't figure out how to use them and I don't even know if this is what I should be looking at. How do I load the Zend\I18n\Translator\Translator class?

4

1 回答 1

0

使用自动装载机,您可以:

require_once 'Zend/Loader/StandardAutoloader.php';
$loader = new Zend\Loader\StandardAutoloader(array(
    'fallback_autoloader' => true,
));
$loader->register();

use Zend\I18n\Translator\Translator;
于 2013-05-07T02:34:49.333 回答