我有一个PHP问题。array_push()期望参数1是数组
我有这样的代码块
$arr_foundits = array();
foreach($its as $it){
//print_r($it);
$post_categories = wp_get_post_categories($it->ID);
$cats = array();
foreach($post_categories as $c){
$cat = get_category($c);
$catname = strtolower($cat->name);
//print_r($catname);
if($catname=='uncategorized'){
continue;
}
$squery = get_search_query();
if(strpos($catname, strtolower($squery))!==false){
//echo 'ceva';
$found = true;
$arr_foundits = array_push($arr_foundits, $it->ID);//line 80 hier
printf('<li><h4><a href="%1$s">%2$s</a></h4><p>%3$s</p></li>', get_permalink($it->ID), $it->post_title, get_the_excerpt_by_id($it->ID));
}
}
}
我遇到的问题是与$ arr_foundits阵列,我总是收到此错误,并明确了,因为我声明它有一个在阵列中,丝毫不为整数,无处。
对此错误的任何解决方案?
a http://imgbin.org/images/13129.png
它显然不是由于错误信息。var_dump或print_r你的“数组”,并发布结果 – 2013-04-28 01:26:45
你应该只做'$ arr_foundits [] = $ it-> ID' ... – 2013-04-28 01:41:31
这是一个基于文本的在线网站,请插入文本信息作为文本 - 而不是截图。这对于具体的错误消息很重要。 – hakre 2013-05-18 21:58:18