我有以下代码从帖子内容中提取前30个单词:
$extract = explode (' ', $post->post_content);
$first_thirty = array_slice($extract, 0, 30);
echo $first_thirty;
但当我echo $first_thirty;
打印“数组”时,我怎样才能正确打印。
答案 0 :(得分:1)
将前三十个单词组合成一个字符串,然后回显它:
echo implode(' ', $first_thirty);