Skip to content

Instantly share code, notes, and snippets.

@mygoare
Created February 9, 2012 07:02
Show Gist options
  • Save mygoare/1777994 to your computer and use it in GitHub Desktop.
Save mygoare/1777994 to your computer and use it in GitHub Desktop.
php throw err try catch获取异常
<?php
function de($a)
{
if($a==0)
{
throw new Exception("can't be zero!");
}
}
try
{
de(0);
}
catch(Exception $e)
{
echo "error: ".$e->getMessage();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment