![](/img/trans.png)
[英]Cakephp 1.3 - How is the validation error message added to the div of the field?
[英]how to handle this error in cakephp 1.3
我使用pregmatch从文章文字中提取图片名称...因此,当管理员不在文章中添加图片时,他会看到此错误
Notice (8): Uninitialized string offset: 0 [CORE\cake\libs\view\helpers\html.php, line 608]
无论如何要停止显示此错误,如果管理员未添加图像
<?php
echo $html->link( $html->image($imagename,array('height'=>'250px', 'width'=>'280px')),array('action' => 'view', $article['Article']['id']),array('escape' => false));
?>
如果我理解正确,那么您正在解析文章文本以获取图像链接并将其显示在视图中的某个位置。
回声前检查
<?php
if(isset($imagename) && $imagename != ""){
echo $html->link( $html->image($imagename,array('height'=>'250px','width'=>'280px')),array('action' => 'view',$article['Article']['id']),array('escape' => false));
}
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.