这是$vo dump出来的数据$vo.more.thumbnail
可以正常取出thumbnail图片
我想取出photos的图片,用这个方法报错提示photos未定义
<foreach $vo['more']['photos'] as $photo>
{$photo.url}
</foreach>
2017-08-29 18:22
这是dump $vo得到的数据
object(app\portal\model\PortalPostModel)#113 (32) {
["type":protected] => array(1) {
["more"] => string(5) "array"
}
["autoWriteTimestamp":protected] => bool(true)
["connection":protected] => array(0) {
}
["parent":protected] => NULL
["query":protected] => NULL
["name":protected] => string(10) "PortalPost"
["table":protected] => NULL
["class":protected] => string(32) "app\portal\model\PortalPostModel"
["error":protected] => NULL
["validate":protected] => NULL
["pk":protected] => NULL
["field":protected] => array(0) {
}
["readonly":protected] => array(0) {
}
["visible":protected] => array(0) {
}
["hidden":protected] => array(0) {
}
["append":protected] => array(0) {
}
["data":protected] => array(27) {
["id"] => int(91)
["parent_id"] => int(0)
["post_type"] => int(1)
["post_format"] => int(1)
["user_id"] => int(1)
["post_status"] => int(1)
["comment_status"] => int(1)
["is_top"] => int(0)
["recommended"] => int(0)
["post_hits"] => int(4)
["post_like"] => int(0)
["comment_count"] => int(0)
["create_time"] => int(1503374642)
["update_time"] => int(1503991165)
["published_time"] => int(1503374580)
["delete_time"] => int(0)
["post_title"] => string(12) "微赢天下"
["post_keywords"] => string(0) ""
["post_excerpt"] => string(12) "微赢天下"
["post_source"] => string(0) ""
["post_content"] => string(31) "<p>微赢天下</p>"
["post_content_filtered"] => NULL
["more"] => string(185) "{"thumbnail":"portal\/20170822\/72192792291f28b8d62605b1dda87270.jpg","template":"","photos":[{"url":"portal\/20170829\/76bcf5d289f68d83422ee9f9f5564355.jpg","name":"未标题-1.jpg"}]}"
["user_login"] => string(5) "admin"
["user_nickname"] => string(5) "admin"
["user_email"] => string(17) "1971461148@qq.com"
["category_id"] => int(9)
}
["origin":protected] => array(27) {
["id"] => int(91)
["parent_id"] => int(0)
["post_type"] => int(1)
["post_format"] => int(1)
["user_id"] => int(1)
["post_status"] => int(1)
["comment_status"] => int(1)
["is_top"] => int(0)
["recommended"] => int(0)
["post_hits"] => int(4)
["post_like"] => int(0)
["comment_count"] => int(0)
["create_time"] => int(1503374642)
["update_time"] => int(1503991165)
["published_time"] => int(1503374580)
["delete_time"] => int(0)
["post_title"] => string(12) "微赢天下"
["post_keywords"] => string(0) ""
["post_excerpt"] => string(12) "微赢天下"
["post_source"] => string(0) ""
["post_content"] => string(31) "<p>微赢天下</p>"
["post_content_filtered"] => NULL
["more"] => string(185) "{"thumbnail":"portal\/20170822\/72192792291f28b8d62605b1dda87270.jpg","template":"","photos":[{"url":"portal\/20170829\/76bcf5d289f68d83422ee9f9f5564355.jpg","name":"未标题-1.jpg"}]}"
["user_login"] => string(5) "admin"
["user_nickname"] => string(5) "admin"
["user_email"] => string(17) "1971461148@qq.com"
["category_id"] => int(9)
}
["relation":protected] => array(0) {
}
["auto":protected] => array(0) {
}
["insert":protected] => array(0) {
}
["update":protected] => array(0) {
}
["createTime":protected] => string(11) "create_time"
["updateTime":protected] => string(11) "update_time"
["dateFormat":protected] => bool(false)
["isUpdate":protected] => bool(true)
["updateWhere":protected] => NULL
["failException":protected] => bool(false)
["useGlobalScope":protected] => bool(true)
["batchValidate":protected] => bool(false)
["resultSetType":protected] => string(10) "collection"
["relationWrite":protected] => NULL
}
photos数据先 json_decode 转成数组,再循环输出