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

ReflectionClass::newInstanceWithoutConstructor

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

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

說明

public ReflectionClass::newInstanceWithoutConstructor(): object

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

參數(shù)

返回值

更新日志

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

錯誤/異常

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

參見