Home  >  Article  >  Backend Development  >  php怎么在array()的括号里面写入一个数组的值

php怎么在array()的括号里面写入一个数组的值

WBOY
WBOYOriginal
2016-06-13 12:39:591388browse

php如何在array()的括号里面写入一个数组的值
是这样的  我的一个页面显示了所有的分类  我想把一些分类隐藏掉不显示
我用了下面的代码  但是有一个地方弄不好麻烦你看下会不会 谢了
if ( ! in_array( $term->slug, array(  ) ) ){         
           $new_terms[] = $term;
      }
我用了这段程序实现让一部分分类不显示  比如说我不想显示slug值为A的分类 就写成array('A')就可以
但是我想不显示的有很多  需要从数据库的表里筛选出来
$shaixuankuwp_terms=mysql_query("SELECT * FROM `wp_terms` where term_id='".$duqu_term_id."'");
这段我筛选出了表里所有我想不显示分类的行
while ($duqushujukuwp_terms=mysql_fetch_array($shaixuankuwp_terms)){ $duqu_slug=$duqushujukuwp_terms[slug]; }
这段我一行一行读出了分类的slug
貌似这样读出来的slug值每次都会被新读的取代  我是不是要把值再放到一个数组里啊
而且貌似array()里面不能放数组 只能一条条放
但是我又不知道该怎么把$duqu_slug 这个全部放到上面的array()里面
麻烦帮忙看看怎么改啦  谢谢啦
我是新手啊  请尽量详细点解释  谢谢各位大神啦

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn