<code> $recent_posts = wp_get_recent_posts( 'orderby=rand&showposts=' . $number . '&category=' . $fenlei ); //遍历出每一篇文章。 foreach( $recent_posts as $recent ){ $a = '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' . $recent["post_title"].'</a> </li> '; $b[] = $a; } return $b[0].$b[1].$b[2].$b[3].$b[4]; } </code>小弟写了这么个遍历文章的玩意,但是有个不解的地方就是,小弟在用数组接收遍历的内容后,通过这种 return $b[0].$b[1].$b[2].$b[3].$b[4]; 方式能把数组返回显示出来,但是直接用 return $b; 就显示 array ,实在是无语了,小弟今天才学的php,望各位大神指教
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号