how to write variables value with file_put_contents()?

前端 未结 5 932
北海茫月
北海茫月 2021-01-21 10:28

Have been trying to figure this out all day assuming its just a small error.....

I\'m trying to use the file_put_content to put a variables value into anoth

5条回答
  •  孤街浪徒
    2021-01-21 11:08

    The problem is that you are using single quotes, so the variables are not shown.

    Change:

    file_put_contents("/home/files/1/741/html/WP/$GDI_user/config.php",'');
    

    to:

    file_put_contents("/home/files/1/741/html/WP/$GDI_user/config.php","");
    

    Note that I have changed the double quotes for $affiliate_reference to single quotes. If you need double quotes, you can escape them:

    $affiliate_reference = \"$UNQ_ID\";
    

提交回复
热议问题