how to write variables value with file_put_contents()?

前端 未结 5 930
北海茫月
北海茫月 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:15

    You're using single quotes. You cannot embed variable's values into a single-quoted string. Use concatenation, double-quotes, or heredoc.

    http://php.net/string

    And I think leading zeros in a number might cause problems, but I'm not sure. Plus it's always safe to use addslashes in situations like this.

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

提交回复
热议问题