PHP array mixed write output HTML code this post was last edited by iyangquan at 14:12:43, January 21
$ SQL = "SELECT attr_value, thumb_url ". "FROM ". $ GLOBALS ['ecs']-> table ('goods _ attr '). 'Where goods_id = '. $ row ['goods _ id']. 'And attr_id = 185 order by attr_value asc '; $ cm = $ GLOBALS ['DB']-> getAll ($ SQL); $ ys_arr = array (); $ ysimg_arr = array (); foreach ($ cm as $ val) {$ ys_arr [$ val ['attr _ value'] = $ val ['attr _ value']; $ ysimg_arr [$ val ['thumb _ url'] = $ val ['thumb _ url'];} $ arr [$ row ['goods _ id'] ['attr _ value'] = implode (',', $ ys_arr ); $ arr [$ row ['goods _ id'] ['thumb _ url'] = implode ('', $ ysimg_arr );
Thumb_url adds HTML code to the output value and displays the image directly.
Reply to discussion (solution)
I don't know what you want to do
I don't know what you want to do
The value of thumb_url now outputs the complete image address. I want to add
Mixed write HTML output
$ Ysimg_arr [$ val ['thumb _ url'] = "";
$ Ysimg_arr [$ val ['thumb _ url'] = "";
Thanks
The braces are missing.