数组
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) "SAAB系统"
["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) "2013-11-08 17:45:12" 里面的日期换成‘xxxx-xx-xx’格式
这样,已经确定了uptime这个键名在第二维是吧
使用
foreach ($array as &$arr){
$arr['uptime'] = date('Y-m-d', strtotime($arr['uptime'])); //改变字段值
$arr['new_color'] = "red"; //添加新的字段
}