PHP + MYSQLI: Variable parameter/result binding with prepared statements

前端 未结 5 2115
囚心锁ツ
囚心锁ツ 2020-12-13 16:38

In a project that I\'m about to wrap up, I\'ve written and implemented an object-relational mapping solution for PHP. Before the doubters and dreamers cry out \"how on earth

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 17:14

    In PHP you can pass a variable number of arguments to a function or method by using call_user_func_array. An example for a method would be:

    call_user_func_array(array(&$stmt, 'bindparams'), $array_of_params);
    

    The function will be called with each member in the array passed as its own argument.

提交回复
热议问题