php wordwrap() 函数是用于在指定的宽度处将字符串进行换行的函数。它的语法如下:
wordwrap(string $str, int $width, string $break, bool $cut = false): string
参数说明:
返回值: 返回被换行后的字符串。
示例:
$str = "This is a long string that needs to be wrapped.";
$wrappedStr = wordwrap($str, 10, "<br>");
echo $wrappedStr;
输出结果:
This is a<br>
long<br>
string<br>
that needs<br>
to be<br>
wrapped.
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站