Typecho中如何判断getDescription()返回值是否为空?
typecho判断 “getdescription(); ?>” 值是否为空
typecho 中判断上述值是否为空的方法非常简单,可以使用三元表达式:
<?php echo $this->getdescription() ? 1 : 2 ?>
如果 $this->getdescription() 的值不为空,则输出 1;否则输出 2。
例如:
$description = ”; // 假设 $description 为空值echo $description ? 1 : 2; // 输出 2
$description = ‘Typecho’; // 假设 $description 不为空echo $description ? 1 : 2; // 输出 1
以上就是Typecho中如何判断getDescription()返回值是否为空?的详细内容,更多请关注范的资源库其它相关文章!