PHP preg_替换给定空字符串

PHP preg_替换给定空字符串,php,Php,我正在尝试替换一些字符串,但是它不起作用 $content = get_the_content(); $content = wp_strip_all_tags($content); $thingsToReplace = array ('/\s+/','/\\\\/', '"'); $toReplaceWith = array (' ',' ','\"'); var_dump($content); //here it works fine $content = preg_rep

我正在尝试替换一些字符串,但是它不起作用

$content = get_the_content();
$content = wp_strip_all_tags($content);
$thingsToReplace = array ('/\s+/','/\\\\/', '"');
$toReplaceWith = array (' ',' ','\"');
var_dump($content); //here it works fine
$content = preg_replace( $thingsToReplace, $toReplaceWith, $content);

var_dump($content); //here it gives an empty string
我尝试使用
var\u dump()
对其进行故障排除,以上是我的发现

我做错了什么?你能帮我解决这个问题吗


谢谢

请分别启动正确的PHP错误报告。WP调试模式。PHP可以立即告诉您这里到底出了什么问题。[02-Oct-2020 11:14:45 UTC]PHP警告:preg_replace():在single.PHP的第42行中找不到结尾分隔符“”,是否应该这样写?
array('/\s+/','/\\\/','/“/”)是的,当然,它必须是有效的正则表达式,与前两个相同。