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 211 views
3 answers 463 views
1 answer 194 views
1 answer 175 views
175 views asked Jun 29, 2022 by avibootz
1 answer 298 views
...