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 

use file_put_contents

$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

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

Bubble Sort Manually a Linked List in Java -

asp.net mvc - SSO between MVCForum and Umbraco7 -