PHP, if parsing the json array, display the picture directly on the page.

json data is as follows
how to extract the pages or iamges picture links in the data in json, and then display only pictures on the web page, I Xiaobai, please directly post the required code below, thank you!

{"api":"mtop.wdetail.getItemDescx","data":{"pages":["https://assets.alicdn.com/kissy/1.0.0/build/imglazyload/spaceball.gifhttps://img.alicdn.com/imgextra/i1/4140697362/O1CN0124FqIYTz5Xqnvzl_!!4140697362.jpghttps://img.alicdn.com/imgextra/i3/4140697362/O1CN0124FqIYsmwLWDmae_!!4140697362.jpghttps://img.alicdn.com/imgextra/i2/4140697362/O1CN0124FqIXudDHUkOk7_!!4140697362.jpghttps://img.alicdn.com/imgextra/i4/4140697362/O1CN0124FqIXucsVIs5fW_!!4140697362.jpghttps://img.alicdn.com/imgextra/i4/4140697362/O1CN0124FqIY183hyc9Sk_!!4140697362.jpghttps://img.alicdn.com/imgextra/i4/4140697362/O1CN0124FqIX97438mDBf_!!4140697362.jpghttps://img.alicdn.com/imgextra/i3/4140697362/O1CN0124FqIX96vjC6FSu_!!4140697362.jpg","https://img.alicdn.com/imgextra/i3/4140697362/O1CN0124FqIXeaGXaG8q8_!!4140697362.jpghttps://img.alicdn.com/imgextra/i4/4140697362/O1CN0124FqIWExfEmkGyu_!!4140697362.jpghttps://img.alicdn.com/imgextra/i2/4140697362/O1CN0124FqIX98bbym5hf_!!4140697362.jpghttps://img.alicdn.com/imgextra/i4/4140697362/O1CN0124FqIYH5hrsI9Vc_!!4140697362.jpghttps://img.alicdn.com/imgextra/i1/4140697362/O1CN0124FqIYsoY5t9BUJ_!!4140697362.jpg"],"images":["https://assets.alicdn.com/kissy/1.0.0/build/imglazyload/spaceball.gif","https://img.alicdn.com/imgextra/i1/4140697362/O1CN0124FqIYTz5Xqnvzl_!!4140697362.jpg","https://img.alicdn.com/imgextra/i3/4140697362/O1CN0124FqIYsmwLWDmae_!!4140697362.jpg","https://img.alicdn.com/imgextra/i2/4140697362/O1CN0124FqIXudDHUkOk7_!!4140697362.jpg","https://img.alicdn.com/imgextra/i4/4140697362/O1CN0124FqIXucsVIs5fW_!!4140697362.jpg","https://img.alicdn.com/imgextra/i4/4140697362/O1CN0124FqIY183hyc9Sk_!!4140697362.jpg","https://img.alicdn.com/imgextra/i4/4140697362/O1CN0124FqIX97438mDBf_!!4140697362.jpg","https://img.alicdn.com/imgextra/i3/4140697362/O1CN0124FqIX96vjC6FSu_!!4140697362.jpg","https://img.alicdn.com/imgextra/i3/4140697362/O1CN0124FqIXeaGXaG8q8_!!4140697362.jpg","https://img.alicdn.com/imgextra/i4/4140697362/O1CN0124FqIWExfEmkGyu_!!4140697362.jpg","https://img.alicdn.com/imgextra/i2/4140697362/O1CN0124FqIX98bbym5hf_!!4140697362.jpg","https://img.alicdn.com/imgextra/i4/4140697362/O1CN0124FqIYH5hrsI9Vc_!!4140697362.jpg","https://img.alicdn.com/imgextra/i1/4140697362/O1CN0124FqIYsoY5t9BUJ_!!4140697362.jpg"]},"ret":["SUCCESS::"],"v":"4.1"}

added the print code to show that it is like this, how can you directly display the picture on the web page?

Array ( [0] => https://img.alicdn.com/imgextra/i4/3919991333/O1CN01MfB4hy1LiYRyqTeGo_!!3919991333.jpg [1] => https://img.alicdn.com/imgextra/i1/3919991333/O1CN01j13pFB1LiYRKPy1f2_!!3919991333.jpg [2] => https://img.alicdn.com/imgextra/i2/3919991333/O1CN01niSulX1LiYRLk2In0_!!3919991333.jpg [3] => https://img.alicdn.com/imgextra/i1/3919991333/O1CN018tTxkR1LiYRyYYQuR_!!3919991333.jpg [4] => https://img.alicdn.com/imgextra/i3/3919991333/O1CN01SdhQzR1LiYRVzn3fK_!!3919991333.jpg [5] => https://img.alicdn.com/imgextra/i4/3919991333/O1CN01mlGQnk1LiYRVHkEqG_!!3919991333.jpg [6] => https://img.alicdn.com/imgextra/i2/3919991333/O1CN01gGzaW01LiYQy3Hrk8_!!3919991333.jpg [7] => https://img.alicdn.com/imgextra/i3/3919991333/O1CN01M7E7gz1LiYQyVXknf_!!3919991333.jpg [8] => https://img.alicdn.com/imgextra/i1/3919991333/O1CN01wN9dyU1LiYQy7JPJl_!!3919991333.jpg [9] => https://img.alicdn.com/imgextra/i4/3919991333/O1CN011FMGeN1LiYQwuTfC6_!!3919991333.jpg [10] => https://img.alicdn.com/imgextra/i1/3919991333/O1CN01zSOBV21LiYQzx2hDh_!!3919991333.jpg [11] => https://img.alicdn.com/imgextra/i2/3919991333/O1CN018XlfsL1LiYQz7CgyX_!!3919991333.jpg ) 
Jul.11,2022

so

$arr=json_decode($json,true);//json
foreach($arr as $val){
    echo '<img src="'.$val.'"/>';
}

json_decode


does it feel that your images and pages are the same? It would be nice to just take images.

clipboard.png

clipboard.png


you can refer to the method of the first classmate for analytical development.
PHP backend processing is done with $arr = json_decode ($json,true); get the array, print to view the array structure and get the image path.


ajax returns data. Just take the data. For example, what data.data.images gets is an array of images that can be traversed once

Menu