[英]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.