Try/Catch & If Statement Weirdness
Running into an issue when using an if/else 开发者_如何学编程statement within a try/block.
try {
$response = $flickr->callPhotos($content, $limit);
if($response['stat'] === 'fail'){
throw new Exception('Please authorize this application.');
} else {
--> Code that should not be parsed <--
}
}
catch (Exception $e){
echo $e->getMessage();
}
When running this code for some reason the error is thrown correctly, the error is echoed correctly, but then the "Code that should not be parsed" is also being allowed to run generating more errors.
Any thoughts? Thanks in advance.
精彩评论