call_user_func_array(array($ stmt,'bind_result'),$ parameters)如果从浏览器运行,则base64图像绑定结果不起作用

时间:2014-12-16 21:04:18

标签: php mysql database mysqli apache2

在我的项目中,我使用简单的phpmysql库:https://github.com/joshcam/PHP-MySQLi-Database-Class。 在get()方法中,我试图将存储为base64字符串的图像数据提供给我的mysql数据库表。当我试图发送此请求时

$db->where("accessibility_data_id = ".$RequestId);
$result = $db->get("accesspath_data",NULL,Array("image_name,upload_time,image_height,image_width,image"));

查询是:

protected function _dynamicBindResults(mysqli_stmt $stmt)
{
    $parameters = array();
    $results = array();

    //echo 'called for processing';
    $meta = $stmt->result_metadata();

    echo var_dump($meta);
   // echo $meta;
    // if $meta is false yet sqlstate is true, there's no sql error but the query is
    // most likely an update/insert/delete which doesn't produce any results
    if(!$meta && $stmt->sqlstate) {
        return array();
    }
   //echo 'problem meta';
    $row = array();
    while ($field = $meta->fetch_field()) {
        $row[$field->name] = null;
        $parameters[] = & $row[$field->name];
    }

   //echo 'meta processed';
    // avoid out of memory bug in php 5.2 and 5.3
    // https://github.com/joshcam/PHP-MySQLi-Database-Class/pull/119
    if (version_compare (phpversion(), '5.4', '<'))
         $stmt->store_result();

    //echo 'version compare done'.$parameters;
   echo var_dump($parameters);
   try{
    echo 'inserted';
    call_user_func_array(array($stmt, 'bind_result'), $parameters);
    echo 'exit';
   }
   catch (Exception $e) {
    echo 'exception';
        echo 'Caught exception: ',  $e->getMessage(), "\n";
    }
    echo 'fetching\n';
    while ($stmt->fetch()) {
        $x = array();
        foreach ($row as $key => $val) {
            $x[$key] = $val;
        }
        $this->count++;

        array_push($results, $x);
    }

    echo $results;
    //echo 'result processed';
    //echo print_r($results);
    return $results;

}

但是,如果我从查询中删除参数图像,它可以正常工作。如果我使用php命令行执行,这也适用。

0 个答案:

没有答案