我浏览了文档和这个网站,但仍然不确定.我正在使用Drupal 7.
使用以下代码打印变量:
<?php print $info['comments'] ?>
Run Code Online (Sandbox Code Playgroud)
如果我得到的评论为零
Notice: Undefined index as a message.
Run Code Online (Sandbox Code Playgroud)
如果存在,则打印正确的#.
任何帮助,将不胜感激.如何设置它如果没有注释它显示为零?
谢谢!
无论如何打印整数:
<?php print @intval($info['comments']) ?>
Run Code Online (Sandbox Code Playgroud)
或者不可撤销地压制通知:
<?php print isset($info['comments']) ? $info['comments'] : 0 ?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
389 次 |
| 最近记录: |