我的环境(Zend 服务器):
PHP Version 5.4.11
Zend Server Version: 6.0.1
Zend Framework: 1.12.3, 2.1.4
Zend Server Gateway: 0.9.0.201301302347
Build: 69400
所以我尝试用 ZF2 形式的官方教程编写我的第一个应用程序。
骨架应用中的 ZF 版本:2.2
这是我的项目的链接,如果有人想仔细看看的话。
config/module.config.php
<?php
return array(
'controllers' => array(
'invokables' => array(
'Album\Controller\Album' => 'Album\Controller\AlbumController',
),
),
'view_manager' => array(
'template_path_stack' => array(
'album' => __DIR__ . '/../view',
),
),
);
module\Album\Module.php
<?php
namespace Album;
class Module
{
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\ClassMapAutoloader' => array(
__DIR__ . '/autoload_classmap.php',
),
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}
}
这是我的错误:
Zend\ModuleManager\Listener\Exception\InvalidArgumentException: Config being merged must be an array, implement the Traversable interface, or be an instance of Zend\Config\Config. integer given. in F:\Zend\Apache2\htdocs\learnzf2\vendor\zendframework\zendframework\library\Zend\ModuleManager\Listener\ConfigListener.php on line 317
Call Stack
# Time Memory Function Location
1 1.0510 137456 {main}( ) ..\index.php:0
2 1.0986 163240 Zend\Mvc\Application::init( ) ..\index.php:18
3 1.2171 345520 Zend\ModuleManager\ModuleManager->loadModules( ) ..\Application.php:253
4 1.2171 345680 Zend\EventManager\EventManager->trigger( ) ..\ModuleManager.php:109
5 1.2171 345936 Zend\EventManager\EventManager->triggerListeners( ) ..\EventManager.php:207
6 1.2195 354296 call_user_func ( ) ..\EventManager.php:468
7 1.2195 354312 Zend\ModuleManager\ModuleManager->onLoadModules( ) ..\EventManager.php:468
8 1.2371 383920 Zend\ModuleManager\ModuleManager->loadModule( ) ..\ModuleManager.php:90
9 1.2390 384984 Zend\EventManager\EventManager->trigger( ) ..\ModuleManager.php:154
10 1.2391 385016 Zend\EventManager\EventManager->triggerListeners( ) ..\EventManager.php:207
11 1.2431 391096 call_user_func ( ) ..\EventManager.php:468
12 1.2431 391112 Zend\ModuleManager\Listener\ConfigListener->onLoadModule( ) ..\EventManager.php:468
13 1.2439 391464 Zend\ModuleManager\Listener\ConfigListener->addConfig( ) ..\ConfigListener.php:127
What is problem with it?
我试图调试它,但我不知道我的代码有什么问题,除了它是 int 值,即使我在config/module.config.php
.
附言。早些时候,我没有使用 Xdebug (+PHPStorm),例如,当我将断点放入
config/module.config.php
. )。这是正常的还是我做错了什么?