数组: array(6) { [0]=> array(11) { ["id"]=> string(2) "76" ["topic_id"]=> string(1) "2" ["title"]=> string(48) "大社区的完善配套大社区的完善配套" ["kwords"]=> string(0) "" ["description"]=> string(48) "大社区的完善配套大社区的完善配套" ["content"]=> string(55) "<p>大社区的完善配套大社区的完善配套</p>" ["pic"]=> string(32) "./uploads/201411080511370202.png" ["author"]=> string(6) "系统" ["uptime"]=> string(19) "2014-11-08 17:25:37" ["is_show"]=> string(1) "1" ["article_topic"]=> array(4) { ["id"]=> string(1) "2" ["name"]=> string(12) "工程进度" ["parent_id"]=> string(1) "0" ["is_show"]=> string(1) "1" } } [1]=> array(11) { ["id"]=> string(2) "75" ["topic_id"]=> string(1) "2" ["title"]=> string(48) "大社区的完善配套大社区的完善配套" ["kwords"]=> string(0) "" ["description"]=> string(48) "大社区的完善配套大社区的完善配套" ["content"]=> string(55) "<p>大社区的完善配套大社区的完善配套</p>" ["pic"]=> string(32) "./uploads/201411080511220202.png" ["author"]=> string(6) "系统" ["uptime"]=> string(19) "2014-11-08 17:25:22" ["is_show"]=> string(1) "1" ["article_topic"]=> array(4) { ["id"]=> string(1) "2" ["name"]=> string(12) "工程进度" ["parent_id"]=> string(1) "0" ["is_show"]=> string(1) "1" } } . . . } //要把每个 ["uptime"]=>string(19) "2014-11-08 17:25:22" 里面的日期换成‘xxxx-xx-xx’格式
这样,已经确定了uptime这个键名在第二维是吧 使用 foreach ($array as &$arr){ $arr['uptime'] = date('Y-m-d', strtotime($arr['uptime'])); }