Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
base64在PHP中编码MySQL blob,而不分解数据_Php_Mysql - Fatal编程技术网

base64在PHP中编码MySQL blob,而不分解数据

base64在PHP中编码MySQL blob,而不分解数据,php,mysql,Php,Mysql,是否可以获取包含blob的MySQL行,并在所有blob都通过base64\u encode运行时返回该行,而不必首先分解获取结果 范例 $res = $this->stmt->fetchAll(PDO::FETCH_ASSOC); $resArray = array(); $resCount = 0; if ($this->stmt->rowCount() > 0){ foreach($res as $row){ $columnCount

是否可以获取包含blob的MySQL行,并在所有blob都通过
base64\u encode
运行时返回该行,而不必首先分解获取结果

范例

$res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
$resArray = array();
$resCount = 0;
if ($this->stmt->rowCount() >  0){
    foreach($res as $row){
        $columnCount = 0;
        foreach ($row as $key => $val) {                                    
            $columns = $this->stmt->getColumnMeta($columnCount);            
            if(isset($columns['native_type'])){                             
                $columns['type'] == 'blob') {                           
                    $val = base64_encode($val); 
                }
            }
            $columnCount++;
            $resArray[$resCount][$key] = $val;                          
        }   
        $resCount++;
    }           
}
return $resArray;   

}

您可以在查询库中使用。不幸的是,在5.5你可以在你的查询库中使用。不幸的是,5点5分