gpt4 book ai didi

php - Codeigniter 消息 : Parameter 3 to mysqli_stmt_bind_param() expected to be a reference, 给出的值 -- stmt_send_long_data

转载 作者:行者123 更新时间:2023-11-30 00:46:12 25 4
gpt4 key购买 nike

我正在使用 codeigniter,下面的代码已经工作了很长时间,直到我的服务器更新到 PHP 5.4。我的要求是允许上传大型文件并将它们作为 blob 保存在 mysql 数据库中。我无法存储链接引用,因此这不是一个选项。

下面是我的代码。我收到的错误是

Message: Parameter 3 to mysqli_stmt_bind_param() expected to be a reference, value given

从表面上看,我正在通过引用传递所有内容。

任何帮助都会很棒。

function UploadFile($filepath, $contenttype, $fileext, $filename, $filesize)
{
$stmt = $this->db->call_function('stmt_init',$this->db->conn_id);
if($this->db->call_function('stmt_prepare',$stmt, 'INSERT INTO THE_TABLE (user_id, upload_description, upload, content_type, file_ext, file_name, file_size) VALUES(?,?,?,?,?,?,?)'))
{
$clientId = $this->input->post('clientid');
$desc = $this->input->post('uploaddescription');
$userfile = $this->input->post('userfile');

$param = 2;
$chunkSize = 8192;

$this->db->call_function('stmt_bind_param',$stmt, "isbssss", $clientId, $desc, $userfile, $contenttype, $fileext, $filename, $filesize);

if ($fp = @fopen($_FILES['userfile']['tmp_name'], 'r'))
{
while (!feof($fp))
{

$this->db->call_function('stmt_send_long_data',$stmt, $param, fread($fp, $chunkSize));

}
fclose($fp);
}

$result_query = $this->db->call_function('stmt_execute', $stmt);

最佳答案

我终于找到答案了。

Codeigniters 函数 $this->db->call_function 按值而不是按引用传递值。我删除了这个函数调用并直接调用绑定(bind)参数并且它起作用了。

关于php - Codeigniter 消息 : Parameter 3 to mysqli_stmt_bind_param() expected to be a reference, 给出的值 -- stmt_send_long_data,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21347410/

25 4 0