file_get_contents with query string

前端 未结 4 578
粉色の甜心
粉色の甜心 2020-12-06 22:33

i am trying to send email from php i have one php file with all values & other php template file.

(both files are on same server)

i am using file_get_co

4条回答
  •  遥遥无期
    2020-12-06 23:37

    Here's an alternative solution... Use the relative path or absolute path as suggested by "cballou" to read file.

    But insted of wirting a php file use a simple text file put you message template in it replace with something unique like %uname% (replacement keys). Read the file content into a variable and replace the replacement keys with your variable like so,

       $url = "/usr/local/path/to/email_form.txt";
           $a = "uname";
           if(($Content = file_get_contents($url)) === false) {
               $Content = "";
           }else{
               $content = str_replace('%uname%', $a, $content);
           }
    

提交回复
热议问题