duanhui3759 2017-08-02 16:15
浏览 80
已采纳

带有变量的PHP preg_replace()给出了警告错误

This command gives me a warning, and I would like to know how to fix it.

$countDaily = preg_replace($demande_portabilite, "", $last_request);

This is the error I'm getting : Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /var/www/html/PortabiliteForm.php on line 22

Thank you for the help :)

  • 写回答

1条回答 默认 最新

  • duanqinjiao5244 2017-08-02 16:18
    关注

    You need to surround your pattern with some delimiters. Usually the delimiter used is /. So for your code:

    $countDaily = preg_replace("/" . $demande_portabilite . "/", "", $last_request);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?