Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.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 拉威尔<;br>;换行_Php_Html_Json_Laravel_Parsing - Fatal编程技术网

Php 拉威尔<;br>;换行

Php 拉威尔<;br>;换行,php,html,json,laravel,parsing,Php,Html,Json,Laravel,Parsing,我知道当我想将标记转换为新行时,我可以做一个简单的替换。但是我在解析时遇到了一个问题,因为提供的标记不是空的 <br style=\"color: rgb(83, 83, 83); font-family: \" helvetica=\"\" ... 当然,replace不起作用,因为没有这样的字符串可以替换……我不知道从哪里开始解析它,而不是 str_replace("<br>", "\r\n", $single->short_description); str\u

我知道当我想将

标记转换为新行时,我可以做一个简单的替换。但是我在解析时遇到了一个问题,因为提供的

标记不是空的

<br style=\"color: rgb(83, 83, 83); font-family: \" helvetica=\"\" ...
当然,replace不起作用,因为没有这样的字符串可以替换……我不知道从哪里开始解析它,而不是

str_replace("<br>", "\r\n", $single->short_description);
str\u replace(“
”,“\r\n”,$single->short\u description);
试一试

preg\U replace(“//U”、“\r\n”、$single->short\U description);
这样,正则表达式将匹配

,包括其中的任何内容,而不仅仅是空的

str_replace("<br>", "\r\n", $single->short_description);
preg_replace("/<br.*>/U", "\r\n", $single->short_description);