简体   繁体   English

Zend Framework 2-模块中的内部服务器错误

[英]Zend Framework 2 - Internal server error in module

I just created a module with a submodule like Backend\\Entity1 . 我刚刚创建了一个带有子模块的模块,例如Backend\\Entity1 I checked every path and namespace, they all seem to be ok. 我检查了每个路径和名称空间,它们似乎都还不错。

I took out codeblocks one by one but stil I just get via Firebug a 我一个接一个地取出了代码块,但直到我只是通过Firebug获得

"NetworkError: 500 Internal Server Error" “网络错误:500内部服务器错误”

Any ideas what I can do to find the error? 有什么想法我可以找到错误吗?

I just don't know what might be wrong. 我只是不知道有什么问题。 Honestly, why does the framework explain itself what is happening? 老实说,为什么框架要自我解释发生了什么? Its just fishing in the dark now... 现在它只是在黑暗中钓鱼...

BTW: The error.log doesn't show something either... 顺便说一句:error.log也不显示任何内容...

Edit: 编辑:

I'm guessing that this error is raised because my app can't find the phtml files. 我猜是由于我的应用找不到phtml文件而引发此错误。 Maybe I'm wrong but usually when I get this kind of silly error it has something to do with missing files... 也许我错了,但是通常当我收到这种愚蠢的错误时,它与丢失的文件有关...

My config code looks like this: 我的配置代码如下所示:

'view_manager' => array(
    'template_path_stack' => array(
        'entity' => __DIR__ . '/../view',
    ),
),

My namespace is MasterData\\Entity and my add/edit/delete/index.phtml lie under view\\masterdata\\entity . 我的命名空间是MasterData\\Entity ,我的add / edit / delete / index.phtml位于view\\masterdata\\entity

Any ideas how I can tell the TemplatePathStack how to look in this dir for my files? 有什么想法可以告诉TemplatePathStack如何在此目录中查找文件?

If your want your sub module to be accessed create proper route in the parent module to make a way to access your sub module. 如果要访问子模块,请在父模块中创建正确的路由,以提供访问子模块的方法。

I IMHO if you need to create sub modules, create as module and place the modules under modules folder of your application, if you have components or third party modules place it under vendor folder. 我恕我直言,如果您需要创建子模块,将其创建为模块并将模块放置在应用程序的“模块”文件夹下,如果您有组件或第三方模块,请将其放置在“供应商”文件夹下。

This would be easier to manage at later stages an your url will also be much simpler 这将在以后的阶段更易于管理,您的网址也将更加简单

In my case, I created the new model in another way but I had the same error when I tried to see the result in the explorer. 就我而言,我以另一种方式创建了新模型,但是当我尝试在资源管理器中查看结果时遇到了相同的错误。 The problem (in my situation) was the access to files from the explorer, It resolves by changing files's permissions in linux's terminal. 问题(在我的情况下)是从资源管理器访问文件,它通过在Linux终端中更改文件的权限来解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM