0
我想將一個函數應用到對象的每個元素/道具,但似乎array_walk_recursive()
不能在對象上工作。即:array_walk_recursive似乎沒有工作
if($re = $con->query("SELECT id, created_date, contents FROM " .
POST_DATA . " WHERE type = 'news' ORDER BY ".
"created_date DESC LIMIT $amount")) {
if($re->num_rows != 0) {
while($ob = $re->fetch_object()) {
$ob = array_walk_recursive($ob, "_output");
print_r($ob);
die();
}
}
}
將簡單地返回'1'。
我該如何解決這個問題?