fopen - PHP adding $ signs into strings without it being a variable? -
this question has answer here:
i'm making setup page people can write database login etc , create config.php file on webserver info can't write
$file = fopen("config.php", "w"); fwrite($file, "$dbname = $dbname"); i tried
$file = fopen("config.php", "w"); fwrite($file, "$" . "dbname = $dbname"); but doesn't work either.
any way store php variable in file write using php?
as php document says
if string enclosed in double-quotes ("), php interpret following escape sequences special characters: \$ dollar sign
http://php.net/manual/en/language.types.string.php
so if want use $ in double-quotes strings use \$ instead of $.
or use single quotes
Comments
Post a Comment