function openfile($x) { if (file_exists($x)) { $fp = fopen($x,"r"); } else { throw new Exception('ファイルが存在しません'); } } try { openfile(hoge.txt); } catch (Exception $e) { echo $e->getMessage(); }
http://www.objectphp.jp/php/%E4%BE%8B%E5%A4%96%E5%87%A6%E7%90%86/
最近のコメント