大佬教程收集整理的这篇文章主要介绍了php – 无法在mysqli_stmt对象上使用call_user_func_array,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<?PHP class DbHelper { .... public function Execute($query,$params){ $this->open(); # Opens a connection to the database using @L_673_8@i API $stmt = $this->@L_673_8@i->prepare($query); try{ $result = call_user_func_array(array($stmt,'bind_param'),$params); } catch(Exception $eX){ # Handle Exception } } .... } ?>
<?PHP $db = new DbHelper(); $params = array('i',$statEID); $result = $db->Execute('SELECT * FROM mst_cities WHERE State_ID = ?',$params); ?>
当我运行代码时,我得到一个警告:
警告:参数2到@L_673_8@i_stmt :: bind_@R_669_1403@应该是一个引用,值在……中给出
我该怎么办?
call_user_func_array(array($stmt,refValues($params)); function refValues($arr) { if (strnatcmp(PHPversion(),'5.3') >= 0) //Reference is required for PHP 5.3+ { $refs = array(); foreach($arr as $key => $value) $refs[$key] = &$arr[$key]; return $refs; } return $arr; }
以上是大佬教程为你收集整理的php – 无法在mysqli_stmt对象上使用call_user_func_array全部内容,希望文章能够帮你解决php – 无法在mysqli_stmt对象上使用call_user_func_array所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。