$list_new是三维数组,里面根据size_id,增加不同的长度和宽度尺寸 Array ( [1709115930244442] => Array ( [0] => Array ( [id] => 119 [type] => 1 [prompt] => Design a pair of earrings [category_id] => [style_id] => [upload_image] => [image] => https://image.jewelryhunt.net/zhaowu/20240229/cf3c0764b8da63d25b89b17ea79021dd.png [image_id] => 1709166990030453 [image_id_pid] => 1709115930244442 [size_id] => [createtime] => 1709166990 ) [1] => Array ( [id] => 118 [type] => 1 [prompt] => Design a pair of earrings [category_id] => [style_id] => [upload_image] => [image] => https://image.jewelryhunt.net/zhaowu/20240229/51e89aae7c70d153fe58bcb6a3b17bc5.png [image_id] => 1709166936353149 [image_id_pid] => 1709115930244442 [size_id] => [createtime] => 1709166936 ) ) [1709101780997618] => Array ( [2] => Array ( [id] => 92 [type] => 1 [prompt] => Design a necklace [category_id] => [style_id] => [upload_image] => [image] => https://image.jewelryhunt.net/zhaowu/20240228/8dd8d95230c5bd0cb1711f460460f9cd.png [image_id] => 1709108628735260 [image_id_pid] => 1709101780997618 [size_id] => [createtime] => 1709108628 ) ) [1709078780835198] => Array ( [3] => Array ( [id] => 41 [type] => 1 [prompt] => Design a 90s inspired ring. [category_id] => [style_id] => [upload_image] => [image] => https://image.jewelryhunt.net/zhaowu/20240228/a458f33de011504fe1cf0a3062593326.png [image_id] => 1709082181235856 [image_id_pid] => 1709078780835198 [size_id] => [createtime] => 1709082181 ) [4] => Array ( [id] => 39 [type] => 1 [prompt] => Design a 90s inspired ring. [category_id] => [style_id] => [upload_image] => [image] => https://image.jewelryhunt.net/zhaowu/20240228/1c89e90ea6e69fb1f17b28a618cf7ff3.png [image_id] => 1709081737985906 [image_id_pid] => 1709078780835198 [size_id] => [createtime] => 1709081738 ) ) ) if ($list_new){ foreach ($list_new as $k=>$val){ foreach ($val as $kk=>$v) { if ($v['size_id'] == 1) { $list_new[$k][$kk]['size_name'] = '1024 X 1024px';//1:1 $list_new[$k][$kk]['width'] = 512; $list_new[$k][$kk]['height'] = 512; } else if ($v['size_id'] == 2) { $list_new[$k][$kk]['size_name'] = '768 X 1024px';//3:4 $list_new[$k][$kk]['width'] = 384; $list_new[$k][$kk]['height'] = 512; } else if ($v['size_id'] == 3) { $list_new[$k][$kk]['size_name'] = '768 X 1360px';//9:16 $list_new[$k][$kk]['width'] = 384; $list_new[$k][$kk]['height'] = 680; } else if ($v['size_id'] == 4) { $list_new[$k][$kk]['size_name'] = '1024 X 768px';//4:3 $list_new[$k][$kk]['width'] = 512; $list_new[$k][$kk]['height'] = 384; } else { $list_new[$k][$kk]['size_name'] = '1360 X 768px';//16:9 $list_new[$k][$kk]['width'] = 680; $list_new[$k][$kk]['height'] = 384; } $list_new[$k][$kk]['createtime'] = date('F d, Y H:i', $v['createtime']);//转换这种格式May 22,2023 11:28 } }