PHP判断语句
如果$goods.seller_note值不为空,执行<ahref="{$goods.seller_note}"target="_blank"><imgsrc="imag...
如果$goods.seller_note值不为空,执行
<a href="{$goods.seller_note}" target="_blank"><img src="images/bnt_cat.gif" border="0"
/></a>
如果$goods.seller_note值为空,则执行
<a href="javascript:addToCart({$goods.goods_id})"><img src="images/bnt_cat.gif" /></a>
这个判断语句应该怎样写啊? 展开
<a href="{$goods.seller_note}" target="_blank"><img src="images/bnt_cat.gif" border="0"
/></a>
如果$goods.seller_note值为空,则执行
<a href="javascript:addToCart({$goods.goods_id})"><img src="images/bnt_cat.gif" /></a>
这个判断语句应该怎样写啊? 展开
3个回答
展开全部
<!--{if $goods.seller_note eq ''}-->
<a href="javascript:addToCart({$goods.goods_id})"><img src="images/bnt_cat.gif" /></a>
<!--{else}-->
<a href="{$goods.seller_note}" target="_blank"><img src="images/bnt_cat.gif" border="0"
/></a>
<!--{/if}-->
<a href="javascript:addToCart({$goods.goods_id})"><img src="images/bnt_cat.gif" /></a>
<!--{else}-->
<a href="{$goods.seller_note}" target="_blank"><img src="images/bnt_cat.gif" border="0"
/></a>
<!--{/if}-->
展开全部
<?php
if($goods.seller_note) {
?>
<a href="<?php echo $goods.seller_note; ?>" target="_blank"><img src="images/bnt_cat.gif" border="0"
/></a>
<?php
} else {
?>
<a href="javascript:addToCart(<?php echo $goods.goods_id; ?>)"><img src="images/bnt_cat.gif" /></a>
<?php
}
?>
if($goods.seller_note) {
?>
<a href="<?php echo $goods.seller_note; ?>" target="_blank"><img src="images/bnt_cat.gif" border="0"
/></a>
<?php
} else {
?>
<a href="javascript:addToCart(<?php echo $goods.goods_id; ?>)"><img src="images/bnt_cat.gif" /></a>
<?php
}
?>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
if(!empty($goods.seller_note))($goods.seller_note!="")
{?>
<a href="{$goods.seller_note}" target="_blank"><img src="images/bnt_cat.gif" border="0"
/></a>
<?php }
esle
{?>
<a href="javascript:addToCart({$goods.goods_id})"><img src="images/bnt_cat.gif" /></a>
<?php }<?>
{?>
<a href="{$goods.seller_note}" target="_blank"><img src="images/bnt_cat.gif" border="0"
/></a>
<?php }
esle
{?>
<a href="javascript:addToCart({$goods.goods_id})"><img src="images/bnt_cat.gif" /></a>
<?php }<?>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询