Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 我应该把substr放在哪里?_Php - Fatal编程技术网

Php 我应该把substr放在哪里?

Php 我应该把substr放在哪里?,php,Php,我有需要添加substr的代码,以将描述输出限制为100个字符: description=<?=nl2br(strip_tags($v['listing_description']));?> 说明= 在哪里以及如何向此行添加substr 我尝试了几种不同的方法,但没有成功。substr介于nl2br和strip_标签之间: description=<?=nl2br(substr(strip_tags($v['listing_description']), 0, 100));

我有需要添加
substr
的代码,以将描述输出限制为100个字符:

description=<?=nl2br(strip_tags($v['listing_description']));?>
说明=
在哪里以及如何向此行添加
substr


我尝试了几种不同的方法,但没有成功。

substr介于
nl2br
strip_标签之间:

description=<?=nl2br(substr(strip_tags($v['listing_description']), 0, 100));?>
说明=

这是因为您首先想
去掉标签(最里面的括号),然后
substr
到100个字符,然后将新行转换成

s。

您能发布您的尝试吗,这样我们就知道不建议什么了?