如何使用简单的格式化zf2输出错误

如何使用简单的格式化zf2输出错误

本文介绍了如何使用简单的格式化zf2输出错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是newbie与zf2框架。例如,现在我得到这个错误:

 致命错误:未捕获的异常'Zend\ModuleManager\Exception\RuntimeException'消息'Module(ZfcUserOverride)无法初始化'在F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php :189堆栈跟踪:
#0 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(163) :Zend\ModuleManager\ModuleManager-> loadModuleByName(Object(Zend\ModuleManager\ModuleEvent))
#1 F:\Server\domains\zf2-skeleton\vendor\zendframework\\ \\ zendframework\library\Zend\ModuleManager\ModuleManager.php(90):Zend\ModuleManager\ModuleManager-> loadModule('ZfcUserOverride')
#2 [内部函数]:Zend\ ModuleManager\ModuleManager-> onLoadModules(Object(Zend\ModuleManager\ModuleEvent))
#3 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\ library\Zend\EventManager\EventManager.php(468):call_user_func(Array,Object(Zend\ModuleManager\ModuleEvent))
#4 F:\Server\domains\zf2-skeleton \vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(207):Zend\EventManager\EventManager-> triggerListeners('loadModules',Object(Zend\ModuleManager\\ \\ ModuleEvent),NULL)
#5 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(109 ):Zend\EventManager\EventManager-> trigger('loadModules',Object(Zend\ModuleManager\ModuleManager),Object(Zend\ModuleManager\Module事件))
#6 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(252):Zend \ModuleManager\ModuleManager-> loadModules()
#7 F:\Server\domains\zf2-skeleton\public\index.php(17):Zend\Mvc\Application :: init(Array)
#8 {main}抛出在F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ ModuleManager.php在线189

我手动格式化,所以你可以读取正确的错误。 >

很难做到这一点我有一些错误。我如何使zf2正确输出这样的错误?



我需要这样的东西:



解决方案

附带了以可读格式报告错误的模板。如果您安装ZendSkeletonApplication并构建您的应用程序,您将受益于此模板和其他便利。或者,您只能使用或创建自己的。


I am newbie with zf2 framework. For example, now I get this error:

Fatal error: Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException' with  message 'Module (ZfcUserOverride) could not be initialized.' in F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php:189 Stack trace:
#0 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(163): Zend\ModuleManager\ModuleManager->loadModuleByName(Object(Zend\ModuleManager\ModuleEvent))
#1 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(90): Zend\ModuleManager\ModuleManager->loadModule('ZfcUserOverride')
#2 [internal function]: Zend\ModuleManager\ModuleManager->onLoadModules(Object(Zend\ModuleManager\ModuleEvent))
#3 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(468): call_user_func(Array, Object(Zend\ModuleManager\ModuleEvent))
#4 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('loadModules', Object(Zend\ModuleManager\ModuleEvent), NULL)
#5 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(109): Zend\EventManager\EventManager->trigger('loadModules', Object(Zend\ModuleManager\ModuleManager), Object(Zend\ModuleManager\ModuleEvent))
#6 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(252): Zend\ModuleManager\ModuleManager->loadModules()
#7 F:\Server\domains\zf2-skeleton\public\index.php(17): Zend\Mvc\Application::init(Array)
#8 {main} thrown in F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php on line 189

I formatted it manually, so you can read correct error.

It is hard to do it all time I get some error. How I can make zf2 to output such errors correctly?

I need something like this:

解决方案

The ZendSkeletonApplication comes with a template that reports errors in a readable format. If you install the ZendSkeletonApplication and build your application off of it, you’ll benefit from this template and other conveniences. Alternatively, you can use just the standard error template or create your own.

这篇关于如何使用简单的格式化zf2输出错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 10:06