PHP export content as text file

This publish is describing the way to export contents as text file/txt file utilizing php.This could be very straightforward to export content material as textual content file.You can download the textual content file too.

$textContent = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor.'; // custom contents
 		$txtfile = $_SERVER["DOCUMENT_ROOT"]."/download/export_links.txt";
 		$handle = fopen($txtfile, 'w') or die('Cannot open file:  '.$txtfile); // check the file is readable
 		fwrite($handle, $textContent); // write content
		fclose($handle); // close the text file
	 	$downLink = 'download/download.php?f=export_links.txt'; // text file download hyperlink

download.php file could be very urgent due to that file will enable to force download the textual content file.It’s contents as following.


That’s all.Very easy.