简体   繁体   English

如何使用Zend Framework检查$ view-> render中出了什么问题?

[英]How to check what goes wrong in $view->render with Zend Framework?

I'm working on a CMS with Widgets. 我正在使用Widget创建CMS。 On my localhost the followong code works perfect, but I have no idea what I'm doing wrong ... The neede files exist, I think and I get no error message. 在我的本地主机上,followong代码可以完美运行,但是我不知道我在做什么错……我认为需要的文件存在,并且我也没有收到错误消息。 As far as I can see, the error occurs in the one before last line of code and I get no error message. 据我所知,该错误发生在代码的最后一行之前,并且没有收到任何错误消息。

$view = new Zend_View();
$view->setScriptPath(APPLICATION_PATH . '/../public/websites/' . My_Cookie::get('alpha_key') . '/views');
$view->headScript()->appendFile($vervang['conf']['jqueryJS']);
$view->headLink()->appendStylesheet($vervang['conf']['jqueryCSS']);
$view->class = $pluginExtraFinal;
$view->vervang = $vervang['data'];
$view->moduleName = $moduleName;
$parsed =  $view->render($vervang['conf']['viewFile']);
$inhoud = str_replace($plugin, $parsed, $inhoud);

Is there a way to troubleshoot this code? 有没有办法解决此代码? How can I get an error message? 如何获得错误消息? What can be wrong? 有什么事吗

Any suggestions please? 有什么建议吗?

Step 0) Turn on error reporting with error_reporting(E_ALL|E_STRICT); 步骤0)使用error_reporting(E_ALL|E_STRICT);打开错误报告error_reporting(E_ALL|E_STRICT);

Step 0.5) Check your server log for php errors 步骤0.5)检查您的服务器日志中的php错误

Step 1) Conclude where the error resides in your script by 步骤1)通过以下方法得出错误在脚本中的位置:
- commenting out every line, uncomment them back again one line at the time, starting from the top -注释掉每一行,然后从顶部开始再取消注释一次
- replace all parameters in method calls into variables, which you var_dump() to check the content is correctly filled in: -将方法调用中的所有参数替换为变量,您可以使用var_dump()来检查其内容是否正确填写:

$view = new Zend_View();
$script_path = APPLICATION_PATH . '/../public/websites/' . My_Cookie::get('alpha_key') . '/views';
var_dump($script_path); // is it correct? ok, continue with the next one
$view->setScriptPath($script_path);
...

Step 2) Now that you've checked your code for loopholes on both development and production servers, you should check versions of files, ZF included; 第2步)现在,您已经检查了代码在开发服务器和生产服务器上是否存在漏洞,现在应该检查文件版本(包括ZF); server settings; 服务器设置; phpinfo() etc phpinfo()

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

相关问题 在 zend 框架中撤消 view->escape() - Undo a view->escape() in zend framework 手动调用$ view-> render()时,Zend_View帮助器不可用:如何解决? - Zend_View helpers not availble when manually calling $view->render(): how to fix it? 如何在Zend Framework 2中使用插件呈现自定义视图 - How to Render a custom view with plugins in Zend Framework 2 您如何确定视图或控制器中是否有内容? (Zend框架) - How do you decide if something goes in the view or the controller? (Zend Framework) 不需要Zend Framework View的短标签。 $ view-> setUseStreamWrapper(true)是否可以替代? - Do no not want Zend Framework View's short tag. Is there an alternative to $view->setUseStreamWrapper(true)? 您如何在Zend Framework 2中呈现视图(用于HTML电子邮件)? - How do you render a view (for HTML email purposes) in Zend Framework 2? Zend Framework:检查是否已设置Zend View占位符 - Zend Framework: Check if Zend View Placeholder isset 在Zend-Framewok插件中,如何与$ this-> view-> foo =…;类似呢? - In Zend-Framewok plugin, how to do somthing simular to $this->view->foo =…;? 如何在zend框架2中呈现页面? - How to render a page in zend framework 2? 将部分视图呈现给Ajax请求Zend框架3 - Render Partial View to Ajax request Zend framework 3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM