作者:ociVyouzhangzh063_1fd2bf_633 | 来源:互联网 | 2018-04-24 01:35
"$recent_postswp_get_recent_posts('orderbyrand&showposts'.$number.'&category'.$fenlei);遍历出每一篇文章。foreach($recent_postsas$recent){$a''.$recent["post_title"].'';$b[]$
php
$recent_posts = wp_get_recent_posts( 'orderby=rand&showposts=' . $number . '&category=' . $fenlei ); //遍历出每一篇文章。 foreach( $recent_posts as $recent ){ $a = '' . $recent["post_title"].' '; $b[] = $a; } return $b[0].$b[1].$b[2].$b[3].$b[4]; }
小弟写了这么个遍历文章的玩意,但是有个不解的地方就是,小弟在用数组接收遍历的内容后,通过这种 return $b[0].$b[1].$b[2].$b[3].$b[4]; 方式能把数组返回显示出来,但是直接用 return $b; 就显示 Array ,实在是无语了,小弟今天才学的PHP,望各位大神指教