PHP Using a variable when calling a static method

后端 未结 5 615
故里飘歌
故里飘歌 2021-01-14 01:55

I have three classes that all have a static function called \'create\'. I would like to call the appropriate function dynamically based on the output from a form, but am hav

5条回答
  •  南笙
    南笙 (楼主)
    2021-01-14 02:29

    What you have works as of PHP 5.3.

    ps. You should consider cleaning the $_POST['class'] since you cannot be sure what will be in it.

提交回复
热议问题