Quantcast
Channel: tipshare.info
Viewing all articles
Browse latest Browse all 20

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

$
0
0
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 all articles
Browse latest Browse all 20

Trending Articles