Can the Str_replace function in PHP replace 3 at a time?
$content = Str_replace (' #p # subtitle #e# ', ', $body);
$content = Str_replace (' See next Page ', ' ', $body);
$content = Str_replace ('/uploads ', ' http://www.****.com/uploads ', $body);
Guys, I want the output of the $body read content, while replacing the inside of the "#p # subtitle #e#" "' See next Page" "/uploads"
How does it come true, please? Now only the last statement can be replaced, and 3 cannot be replaced at the same time
------to solve the idea----------------------
$body =<<< ' TXT '
Guys, I want the output of the $body read content, while replacing the inside of the "#p # subtitle #e#" " ' see next Page" "/uploads"
TXT;
$body = Str_replace (' #p # subtitle #e# ', ', $body);
$body = Str_replace (' See next Page ', ' ', $body);
$body = Str_replace ('/uploads ', ' http://www.****.com/uploads ', $body);
Echo $body;
It's more straightforward to write.
Body =<<< ' TXT '
Guys, I want the output of the $body read content, while replacing the inside of the "#p # subtitle #e#" " ' see next Page" "/uploads"
TXT;
$p = Array (' #p # subtitle #e# ', ' see next Page ', '/uploads ');
$r = Array (' ', ' ', ' http://www.****.com/uploads ');
Echo Str_replace ($p, $r, $body);
------to solve the idea----------------------
Header ("content-type:text/html; Charset=utf-8 ");
$body = <<
<>
#p # subtitle #e#
Take a look at the next page
/uploads
BODY;
$content = Str_replace (' #p # subtitle #e# ', ', $body);
$content = Str_replace (' See next Page ', ' ', $body);
$content = Str_replace ('/uploads ', ' http://www.****.com/uploads ', $body);
echo "Pre-replace content:". "
" . $body. "
" . "
";
$arr _orignal_content = Array (' #p # subtitle #e# ', ' see next Page ', '/uploads ');
$arr _replace_content = Array (' ', ' ', ' http://www.baidu.com/uploads ');
$body = Str_replace ($arr _orignal_content, $arr _replace_content, $body);
echo "Replaced content:". "
" . $body;
------to solve the idea----------------------
The upstairs are all positive solutions.
------to solve the idea----------------------
You can use the regular, the three to spell a regular can
------to solve the idea----------------------
After the first replacement, do not use the $body, but with $content in the back of the replacement.
$content = Str_replace (' #p # subtitle #e# ', ', $body);
$content = Str_replace (' See next Page ', ' ', $content);
$content = Str_replace ('/uploads ', ' http://www.****.com/uploads ', $content);