1
可能重複:
How to Truncate a string in PHP to the word closest to a certain number of characters?剝離和修剪關鍵字列表?
我有一個關鍵字像下面
word1, word3, word3, word4, word5
現在說這個名單是400個字符長的字符串。我只想要關鍵字達到255個字符,但我也想修剪最後一個字,因爲它可能只有半個字。
說我修剪的關鍵字列表以及與此
word1, word3, word3, wo
最終如何確保我修剪只有當它的半個字
在這個任何想法硬道理?我不知道從哪裏開始
順便說一句,我使用PHP