preg_replace() 警告:分隔符不能是字母数字或反斜杠

preg_replace() warning : Delimiter must not be alphanumeric or backslash

我有这段代码是为了替换div里面的内容,“>”和“<”在这里是为了避免在我页面的其他地方替换:

$pageParticulier->post_content=preg_replace("#>"+$old_instance['title']+"<#", ">"+$new_instance['title']+"<",$pageParticulier->post_content);

我有这个警告preg_replace(): Delimiter must not be alphanumeric or backslash

但我不明白的是我已经有了模式的分隔符。

php 中的字符串连接使用句点 . 而不是加号 +:

$pageParticulier->post_content = preg_replace(
        "#>" . $old_instance['title'] . "<#", 
        ">" . $new_instance['title'] . "<",
        $pageParticulier->post_content
    );