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);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 adb连接不到手机是怎么回事?
  • ¥15 vs2022无法联网
  • ¥15 TCP的客户端和服务器的互联
  • ¥15 VB.NET操作免驱摄像头
  • ¥15 笔记本上移动热点开关状态查询
  • ¥85 类鸟群Boids——仿真鸟群避障的相关问题
  • ¥15 CFEDEM自带算例错误,如何解决?
  • ¥15 有没有会使用flac3d软件的家人
  • ¥20 360摄像头无法解绑使用,请教解绑当前账号绑定问题,
  • ¥15 docker实践项目