0

在我的functions.php中,我添加了一个用德语引号替换英语的函数。我通过简单的 str_replace 调用来做到这一点,如下所示:

 $content = str_replace (' “', ' „', $content);

现在我想用 preg_replace 来代替,这样我就可以以不同的方式处理特殊情况。然而,这:

 $haekchenunten = "“";
 $regex = /^ . $haekchenunten . /;
 $content = preg_replace ($regex, '„', $content);

导致一个空白页面(我想是 PHP 致命的)。

如何“与 preg_replace 一起使用?

4

1 回答 1

0

如果这是您的代码,请尝试使用引号 ;-)

 $regex = "/^" . $haekchenunten . "/";
于 2012-11-19T12:17:30.160 回答