我有一些麻煩的數組(PHP,WordPress的),如下圖所示:磁盤陣列和字符串整數
array(2) {
[0] => array(1) { [0]=> string(3) "416" }
[1]=> array(1) { [0]=> string(4) "1591" }
}
如何將其轉換爲與整數數組? 問題是,值也是數組,而不是價值觀是這樣的:
array(2) {
[0] => "416" ,
[1]=> "1591"
}
我試圖用get_post_meta得到一些帖子的ID()。
它只是一塊我的代碼:
$course_product = array();
foreach ($comment_ids as $comment_id) {
$course_product[] = get_post_meta(intval($comment_id), '_llms_wc_product_id', true);
}
它給我這個怪陣:
array(2) {
[0]=>
array(1) {
[0]=>
string(3) "416"
}
[1]=>
array(1) {
[0]=>
string(4) "1591"
}
}
非常感謝。你是對的,它是一個數組。我忘記了核心插件代碼有一些變化。現在我可以處理這個。 –