Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
投稿コンテンツから最初の 30 語を抽出する次のコードがあります。
$extract = explode (' ', $post->post_content); $first_thirty = array_slice($extract, 0, 30); echo $first_thirty;
しかし、echo $first_thirty;「配列」を印刷すると、どうすれば正しく印刷できますか。
echo $first_thirty;
最初の 30 語を結合して文字列に戻し、それをエコーします。
echo implode(' ', $first_thirty);