Quantcast
Viewing latest article 3
Browse Latest Browse All 20

PHPで動的にオブジェクトを生成しつつ引数も指定する方法

PHPで動的にオブジェクトを生成しつつ引数も指定する方法 call_user_func_arrayはオブジェクトの生成は出来ないのでリフレクションを使って解決する。 $r = new ReflectionClass($strClassName); $foo = $r->newInstanceArgs($arrayOfConstructorArgs); ご利用は計画的に。 http://stackoverflow.com/questions/2550354/php-passing-parameters-while-creating-new-object-call-user-func-array-for-objec

Viewing latest article 3
Browse Latest Browse All 20

Trending Articles