您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

throw new 和new的区别

2026/1/11 4:37:44发布13次查看
class a extends exception{
function __construct(){
parent::__construct('a',1);
}

}
throw new a(12,1);
这俩有啥区别,用了好久了,刚才好奇就想出来一个这么个问题
回复内容: class a extends exception{
function __construct(){
parent::__construct('a',1);
}

}
throw new a(12,1);
这俩有啥区别,用了好久了,刚才好奇就想出来一个这么个问题
try { $obj = new exception('12', 1); throw $obj;} catch (exception $e) { print_r($e);}//=======================这是等价的try { throw new exception('12', 1);} catch (exception $e) { print_r($e);}
就是抛出一个对象。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product