Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要这样的东西,但动态地从这样的数组中获取:
$array = array("first","second","third");
所以类会这样调用:
$class = new class("first","second","third");
您可以为此使用反射:
$refClass = new ReflectionClass('SomeClass'); $instance = $refClass->newInstanceArgs($args);