= 5.4.0, PHP 7, PHP 8)ReflectionClass::newInstanceWithoutConstructor — 創(chuàng)建一個(gè)新的類實(shí)例而不調(diào)用它的構(gòu)造函數(shù)說明publ">

ReflectionClass::newInstanceWithoutConstructor

(PHP 5 >= 5.4.0, PHP 7, PHP 8)

ReflectionClass::newInstanceWithoutConstructor創(chuàng)建一個(gè)新的類實(shí)例而不調(diào)用它的構(gòu)造函數(shù)

說明

public ReflectionClass::newInstanceWithoutConstructor(): object

創(chuàng)建一個(gè)新的類的實(shí)例而不調(diào)用它的構(gòu)造函數(shù)。

參數(shù)

返回值

更新日志

版本 說明
5.6.0 All internal classes can now be instantiated except for those declared final.

錯(cuò)誤/異常

如果這個(gè)類是一個(gè)不能不調(diào)用構(gòu)造函數(shù)來實(shí)例化的內(nèi)置類,將導(dǎo)致一個(gè) ReflectionException。在 PHP 5.6.0 及更高版本中,此異常僅限于 final 的內(nèi)置類。

參見