<?php
class blue {
function openFile ($inFile) {
if (file_exists ($inFile)) {
# code to open the file here
} else {
throw new Exception
("Cannot open file:$inFile");
}
}
}
$blueObj = new blue ();
try {
$blueObj->openFile ('/home/shull/file.txt');
} catch (Exception $myException) {
echo $myException->getMessage ();
# rest of exception handling code here
}
# rest of blue methods here
?> |