MySQLI binding params using call_user_func_array

后端 未结 7 2307
别跟我提以往
别跟我提以往 2020-11-30 09:01

Please see below my code. I am attempting to bind an array of paramenters to my prepared statement. I\'ve been looking around on the web and can see I have to use call_user_

7条回答
  •  一向
    一向 (楼主)
    2020-11-30 09:42

    Since PHP 5.6, you don't have to mess around with call_user_func_array() anymore.

    Instead of:

    $stmt->bind_param($param_types, $my_params_array);

    you can just use the splat operator, like this:

    $stmt->bind_param($param_types, ...$my_params_array); // exact code

提交回复
热议问题