我认为正则表达式是给你想要的最简单的方法。考虑到这个问题,我相当积极,你要么从来没有听说过它,要么根本不知道它是如何工作的。
因为它非常复杂,我愿意帮助你,直到你完全按照你想要的方式管理它。
我跑了一些测试,这对我有用。
echo preg_replace('/(\.{20}?|.{10,20}?\.)/', '$1<br />', $desc);
这种单一的代码行提出分手标签要么当达到20个字符时,有一个点后面加一个空格,如果有超过10个字符之前,以避免单个字线。
你给将从去的示例文本:。
一个段落如下像“我们的客户服务部将帮助您解决任何问题,你可能有买家负责来回运费我们提供免费的UPS或USPS地面运输到美国大陆我们船内支付的1个工作日内所有其他货运收费(参见购买细节项目的拍卖)所有订单获得UPS或USPS追踪号码
到。:
A Paragraph follows like "Our Customer service dept.<br />
will help you with any issue you might have.<br />
Buyer is responsible for return shipping.<br />
We offer free UPS or USPS ground shipping to the continental U.S.<br />
We ship within 1 business day of payment.<br />
All other shipping rates apply (see auction of item purchased for details).<br />
All orders get a UPS or USPS tracking number.
让我知道如果这是你想要的方式!
如果你回来选择答案,将不胜感激,哈哈! –