preg_replace causing dollar signs get removed

后端 未结 5 655
春和景丽
春和景丽 2020-12-19 05:52

I have an email system, where user write a message and it will send the message. The main problem which I just found, consider this code

    $findEmail = $th         


        
5条回答
  •  抹茶落季
    2020-12-19 06:33

    Pre-parse the replacement text to escape the $ when followed by a number (remember that $n has special meaning when using in the replacement text). See the comment on the php.net docs page:

    If there's a chance your replacement text contains any strings such as "$0.95", you'll need to escape those $n backreferences:

    
    

提交回复
热议问题