PHP replace string after using file_get_contents

后端 未结 2 1483
别跟我提以往
别跟我提以往 2021-01-25 18:53

Hi I am looking to replace words in an html email I am loading via file_get_contents

Here is my code:



        
2条回答
  •  萌比男神i
    2021-01-25 19:30

    $message = str_replace("$SAD", "HAPPY", $message);
    

    needs to be:

    $message = str_replace('$SAD', "HAPPY", $message);
    

    Otherwise PHP will interpret it as the variable $SAD. See this post for an explanation on the difference between single and double quotes.

提交回复
热议问题