在 pdo 中绑定多个值
本文介绍了在 pdo 中绑定多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种无需重复就可以在 PDO 中绑定多个值的简单方法?看看下面的代码:
Is there's an easy way of binding multiple values in PDO without repitition ? Take a look at the following code :
在这里,我以 4 次重复的方式绑定值.那么是否有一种简单的方法可以在 PDO 中绑定多个值?
Here, I binded values in a repepeated way which is 4 times. So is there's an easy way of binding multiple values in PDO ?
推荐答案
你总是可以在 execute() 的参数中绑定值,只要你觉得值被视为 <代码>PDO::PARAM_STR
(字符串).
You can always bind values within the arguments of execute()
as long as you're fine with the values being treated as PDO::PARAM_STR
(string).
您可以像使用任何数组一样使用传递的数组:
You can use the array passed just like any array:
这篇关于在 pdo 中绑定多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!