How to output a message and terminate the current script in PHP

1 Answer

0 votes
$filename = '/data.txt';
$file = fopen($filename, 'r') or exit("unable to open file ($filename)");

  
/*
run: 
 
Warning: fopen(/data.txt): failed to open stream: No such file or directory in ...\test.php 
unable to open file (/data.txt)
   
*/ 

 



answered May 23, 2018 by avibootz

Related questions

1 answer 205 views
3 answers 438 views
1 answer 181 views
1 answer 167 views
167 views asked Jun 29, 2022 by avibootz
1 answer 287 views
...