PHP write string data to a file -
how can write data file php?
here example of needs written:
$filename = 'test.txt'; $keysize = '2048'; $dname = 'www.domain.com';
the end result of test.txt file should this
[ req ] bits = 2048 domain_name = www.domain.com
$output = "[ req ] \nbits = $keysize\ndomain_name = $dname"; file_put_contents($filename, $output);
\n
makes new line. can put $keysize
etc in string because i'm using "
make string - not work '
. see relevant question: what difference between single-quoted , double-quoted strings in php?
Comments
Post a Comment