本文介紹了PHP 中動態 mysqli bind_param 參數的簡單解決方案是什么?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
為了動態構建 bind_param,我在其他 SO 帖子中找到了這個.
To build a bind_param dynamically, I have found this on other SO posts.
call_user_func_array(array(&$stmt, 'bindparams'), $array_of_params);
有人可以用簡單的英語為我分解一下嗎?我特別迷惑,第一個參數是一個數組.
Can someone break this down in plain english for me? I get especially lost that the first argument is an array.
推薦答案
array($stmt, 'bindparams')
是 PHP 在對象 $stmt
上識別方法 bind_params 的方式,因為 PHP 5 你不再需要使用前面的 &
(和 mysqli是 PHP 5 所以這在舊帖子中看起來像是一個小故障).
is PHP's way of identifying method bind_params on the object $stmt
, since PHP 5 you don't need to use the &
in front any longer (and mysqli is PHP 5 so this looks like a glitch in the older post).
你可以在這里看到一個類似的例子
所以
call_user_func_array(array($stmt, 'bindparams'), $array_of_params);
基本上是指?/p>
basically means
$stmt->bind_params($array_of_params[0], $array_of_params[1] ... $array_of_params[N])
這篇關于PHP 中動態 mysqli bind_param 參數的簡單解決方案是什么?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!