国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > 建站經(jīng)驗 > 正文

php動態(tài)綁定變量的用法

2024-04-25 20:37:24
字體:
供稿:網(wǎng)友

本文實例講述了php動態(tài)綁定變量的用法。分享給大家供大家參考。具體如下:

private function bindVars($stmt,$params) {

if ($params != null) {

$types = ''; //initial sting with types

foreach($params as $param) {

//for each element, determine type and add

if(is_int($param)) {

$types .= 'i'; //integer

} elseif (is_float($param)) {

$types .= 'd'; //double

} elseif (is_string($param)) {

$types .= 's'; //string

} else {

$types .= 'b';

//blob and unknown

}

}

$bind_names[] = $types;

//first param needed is the type string

// eg: 'issss'

for ($i=0; $i<count($params);$i++) {

//go through incoming params and added em to array

$bind_name = 'bind' . $i;

//give them an arbitrary name

$$bind_name = $params[$i];

//add the parameter to the variable variable

$bind_names[] = &$$bind_name;

//now associate the variable as an element in an array

}

//call the function bind_param with dynamic params

call_user_func_array(array($stmt,'bind_param'),$bind_names);

}

return $stmt; //return the bound statement

希望本文所述對大家的php程序設(shè)計有所幫助。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 张掖市| 秀山| 独山县| 锦屏县| 瑞丽市| 易门县| 宁津县| 太仆寺旗| 高陵县| 长乐市| 资中县| 宜川县| 伽师县| 雅江县| 资阳市| 黄浦区| 霍林郭勒市| 新民市| 岳普湖县| 陆丰市| 林甸县| 海晏县| 荥阳市| 灯塔市| 马鞍山市| 永顺县| 海晏县| 西城区| 永新县| 长武县| 南漳县| 海丰县| 北宁市| 武山县| 神池县| 西林县| 武清区| 房产| 台州市| 大方县| 西峡县|