<?php class Exception_1 extends Exception { private $error; public function __construct($error) { return $this->error=$error; } } class Exception_2 extends Exception { private $error; public function __construct($error) { return $this->error=$error; } } class Test_throw { public function __construct() { // throw new Exception_1(“error-1″); throw new Exception_2(“error-2″); // throw new Exception(“error-0″); } } try{ $test=new Test_throw; }catch(Exception_1 [...]
转载于:https://www.cnblogs.com/wenjuncool/archive/2012/03/13/2410555.html