Home

zhangyiqun

Thoughts, stories and ideas.

Notes Blog Archives About
30 Mar 2010

php异常控制

即使屏蔽了全局错误,通过throw和catch仍然能够报错

";
            echo inverse(0) . "


"; } catch (Exception $e) { echo '出现了xx型错误: ', $e->getMessage(), "\n"; } // Continue execution echo 'Hello World
'; ?>

*这个错误控制php并不如python方便,因为需要专门写语句来实例化错误输出。有时异常甚至直接在if里就能完成。

Notes Blog Archives About