1

我在 Windows 7 和 zend 框架 2 上使用 WAMP 服务器。我使用模块ZfcTwig来配置Twig模板引擎,但出现此错误:

( ! ) Fatal error: Interface 'Twig_LoaderInterface' not found in
D:\wamp\www\mysocial\libs\ZfcTwig\src\ZfcTwig\Twig\Loader\AbsoluteFilesystem.php on line 10 Call Stack
#   Time    Memory  Function    Location 1  0.0391  140840  {main}( )   ..\index.php:0 2    0.3756  237656  FrBox::Run( )   ..\index.php:15
3   0.7834  282088  Zend\Mvc\Application::init( )   ..\frBox.php:136
4   1.3790  2242488 Zend\Mvc\Application->bootstrap()   ..\Application.php:243
5   1.4070  2541256 Zend\EventManager\EventManager->trigger()   ..\Application.php:146
6   1.4070  2541376 Zend\EventManager\EventManager->triggerListeners()  ..\EventManager.php:208 7   1.4072  2545160 call_user_func ()   ..\EventManager.php:468
8   1.4072  2545176 Zend\Mvc\View\Http\ViewManager->onBootstrap()   ..\EventManager.php:468
9   1.4796  2989624 Zend\Mvc\View\Http\ViewManager->registerViewStrategies( )   ..\ViewManager.php:140
10  1.4796  2989880 Zend\ServiceManager\ServiceManager->get()   ..\ViewManager.php:440
11  1.4797  2990288 Zend\ServiceManager\ServiceManager->create()    ..\ServiceManager.php:442
12  1.4797  2990320 Zend\ServiceManager\ServiceManager->createFromFactory( )    ..\ServiceManager.php:487
13  1.5014  2992816 Zend\ServiceManager\ServiceManager->createServiceViaCallback()  ..\ServiceManager.php:841
14  1.5014  2993072 call_user_func ()   ..\ServiceManager.php:726
15  1.5014  2993096 ZfcTwig\Service\ViewStrategyFactory->createService()    ..\ServiceManager.php:726
16  1.5014  2993184 Zend\ServiceManager\ServiceManager->get()   ..\ViewStrategyFactory.php:13
17  1.5014  2993592 Zend\ServiceManager\ServiceManager->create()    ..\ServiceManager.php:442
18  1.5014  2993624 Zend\ServiceManager\ServiceManager->createFromFactory( )    ..\ServiceManager.php:487
19  1.5022  3000816 Zend\ServiceManager\ServiceManager->createServiceViaCallback()  ..\ServiceManager.php:841
20  1.5023  3001072 call_user_func ()   ..\ServiceManager.php:726
21  1.5023  3001096 ZfcTwig\Service\ViewRendererFactory->createService()    ..\ServiceManager.php:726
22  1.5108  3028320 Zend\ServiceManager\ServiceManager->get()   ..\ViewRendererFactory.php:27
23  1.5108  3028720 Zend\ServiceManager\ServiceManager->create()    ..\ServiceManager.php:442
24  1.5108  3028752 Zend\ServiceManager\ServiceManager->createFromFactory() ..\ServiceManager.php:487
25  1.6081  3035512 Zend\ServiceManager\ServiceManager->createServiceViaCallback()  ..\ServiceManager.php:841 26    1.6081  3035768 call_user_func ()   ..\ServiceManager.php:726
27  1.6081  3035792 ZfcTwig\Service\EnvironmentFactory->createService() ..\ServiceManager.php:726
28  1.6081  3036144 Zend\Loader\StandardAutoloader->autoload()  ..\ServiceManager.php:0
29  1.6082  3036200 Zend\Loader\StandardAutoloader->loadClass() ..\StandardAutoloader.php:217 30    1.6654  3047944 include(
'D:\wamp\www\mysocial\libs\ZfcTwig\src\ZfcTwig\Twig\Loader\AbsoluteFilesystem.php') ..\StandardAutoloader.php:306

你可以帮帮我吗?

4

2 回答 2

2

使用 composer 安装或更新模块及其所有依赖项。有一些变化,几个小时模块被破坏了。

"require": {
...
"zf-commons/zfc-twig": "dev-master",

...
}
于 2012-11-08T23:28:50.927 回答
0

在类似的情况下,错误是:

PHP Fatal error:  Interface 'Twig_LoaderInterface' not found in
..../vendor/twig/twig/lib/Twig/Loader/String.php on line 30

原因在 composer.json 中"twig/twig":"~1.0",它加载版本v1.27

解决方案是"twig/twig":"~1.20"

于 2015-09-25T16:48:20.210 回答