原参考网址 https://blog.csdn.net/pengxuan/article/details/50520781
原因是使用 json_decode 后数组中的对象进行取值
解决方法(2种):
1、使用 json_decode($d, true)。就是使json_decode 的第二个变量设置为 true。
2、json_decode($res) 返回的是一个对象, 不可以使用 $res['key'] 进行访问, 换成 $res->key 就可以了。
原代码
$riqi = json_decode($info['giftdate'],true);
foreach($riqi as $val)
{
var_dump($val['rid']);
}