我有一个数组,我想在运行 foreach 循环之前根据它的特定键进行排序我已经尝试过 ksort 但它在这种情况下不起作用
[0]=>
object(stdClass)#4829 (23) {
["ID"]=>
string(4) "4089"
["post_author"]=>
string(1) "1"
["post_date"]=>
string(19) "2018-10-31 06:28:57"
["post_date_gmt"]=>
string(19) "2018-10-31 06:28:57"
["post_content"]=>
string(48) "Sessions move 1 hour earlier from 30th September"
["post_title"]=> 'test'
}
[1]=>
object(stdClass)#4830 (24) {
["ID"]=>
string(4) "4030"
["post_author"]=>
string(1) "1"
["post_date"]=>
string(19) "2018-10-31 06:28:57"
["post_date_gmt"]=>
string(19) "2018-10-31 06:28:57"
["post_content"]=>
string(48) "Sessions move 1 hour earlier from 30th September"
["post_title"]=> 'test'
}
这是我从我的数据库中获取的数据,我想以相对于post_date. 我需要在为每个循环运行之前对其进行排序以显示课程
幕布斯7119047
慕姐4208626