Categories: Drupal 7PHP

Notice:Undefined offset: 4 在include()之类提示在 drupal7 中的解决方案!

在模板文件中输出一些变量的时候,如果变量不存在,便会提示此类的错误信息,以下是提示截图及解决方案:

Notice:Undefined offset: 4 在include()之类提示

<?php if(isset($content[‘field_power’][0][‘#markup’])) { ?><span>功&nbsp;&nbsp;率:</span><?php print $content[‘field_power’][0][‘#markup’]; ?><br /><?php } ?>

永夜