Opening Files
<?php $file = "data.txt"; if (file_exists ($file)){ try { if ($readfile = fopen ($file, "r")){ echo "File opened successfully."; } else { throw new exception ("Sorry, the file could not be opened."); } } catch (exception $e) { echo $e->getmessage(); } } else { echo "File does not exist."; } ?>