php if 循环,php中foreach循环里面做if判断

{$zhuye_item.smallUrl}{$zhuye_item.note5uuidHeadIdx} [0] => Array ( [noteId] => 389 [deleteFlag] => 0 [note5uuid] => 300000186 [note5uuidAnonym] => [note5uuidHeadIdx] => [{"bigKey":"","smallUrl":"http://xxx/M00\/02\/1A\/wKgBeVZVpBfCUHwTAAA_pWNnYXw019.png","smallKey":"","bigUrl":"http://xxx/M00\/02\/1A\/wKgBeVZVpBeBcOe4AAGAT87yCLw740.png"}] [note2uuid] => 300000186 [note2uuidHeadIdx] => [{"bigKey":"","smallUrl":"http://xxx/M00\/02\/1A\/wKgBeVZVpBfCUHwTAAA_pWNnYXw019.png","smallKey":"","bigUrl":"http://xxx/M00\/02\/1A\/wKgBeVZVpBeBcOe4AAGAT87yCLw740.png"}] [note2uuidAnonym] => [sendTime] => 1448508925 [type] => 0 [content] => 涂抹急急急急急急了踏踏实实试图投资 [replyCnt] => 1 [praiseCnt] => 0 [praiseAble] => 1 [bigKey] => [bigUrl] => http://xxx/M00/02/1A/wKgBeVZVpBeBcOe4AAGAT87yCLw740.png [smallKey] => [smallUrl] => http://xxx/1A/wKgBeVZVpBfCUHwTAAA_pWNnYXw019.png ) [1] => Array ( [noteId] => 366 [deleteFlag] => 0 [note5uuid] => 0 [note5uuidAnonym] => 春野樱 [note5uuidHeadIdx] => 91 [note2uuid] => 300000186 [note2uuidHeadIdx] => [{"bigKey":"","smallUrl":"http://xxx/M00\/02\/1A\/wKgBeVZVpBfCUHwTAAA_pWNnYXw019.png","smallKey":"","bigUrl":"http://xxx/M00\/02\/1A\/wKgBeVZVpBeBcOe4AAGAT87yCLw740.png"}] [note2uuidAnonym] => [sendTime] => 1448505049 [type] => 1 [content] => 0 [replyCnt] => 5 [praiseCnt] => 0 [praiseAble] => 1 )

大概就是两种数组,一种是JSON串,一种就是纯数字的。问题是现在页面foreach循环的时候判断这个长度没有用呢。

回复讨论(解决方案)

判断里面是

头像:

{$zhuye_item.smallUrl}{$zhuye_item.note5uuidHeadIdx}

用户: {$zhuye_item.note5uuidAnonym} 评论: {$zhuye_item.content}打分:{$zhuye_item.content}

循环里头像这块判断不成功

解决了,直接在返回的数组里面加了一个数组长度,页面取值的时候eq一下就好了。

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值