时间:2021-07-01 10:21:17 帮助过:13人阅读
$dir = $_COOKIE["uid"].'/'.date("Y").'/'.date("m").'/'.date("d").'/';$dirUP = "../../../att/".$dir;$dirLink = $dir;$options=array( 'upload_dir' => $dirUP, 'upload_url' => $dirLink, 'delete_type' => 'POST', 'db_host' => 'localhost', 'db_user' => 'root', 'db_pass' => '*****', 'db_name' => '*****', 'db_table' => 'files');
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null) { $file = parent::handle_file_upload( $uploaded_file, $name, $size, $type, $error, $index, $content_range ); if (empty($file->error)) { $sql = 'INSERT INTO `'.$this->options['db_table'] .'` (`name`, `size`, `type`, `title`, `description`)' .' VALUES (?, ?, ?, ? , ?)'; $query = $this->db->prepare($sql); $query->bind_param( 'sisss', $file->name, $file->size, $file->type, $file->title, $file->description ); $query->execute(); $file->id = $this->db->insert_id; } return $file; }
protected function handle_file_upload($uploaded_file, $name, $size, $type,$url, $error, $index = null, $content_range = null) { $file = parent::handle_file_upload( $uploaded_file, $name, $size, $type,$url, $error, $index, $content_range ); if (empty($file->error)) { $sql = 'INSERT INTO `'.$this->options['db_table'] .'` (`name`, `size`, `type`, `url`, `title`, `description`)' .' VALUES (?, ?, ?, ?,? , ?)'; $query = $this->db->prepare($sql); $query->bind_param( 'sisss', $file->name, $file->size, $file->type, $file->url, $file->title, $file->description ); $query->execute(); $file->id = $this->db->insert_id; } return $file; }
警告:mysqli_stmt::bind_param():在类型定义字符串不匹配的绑定变量的元素个数
这还不清楚吗?
$query->bind_param(
' sisss', //怎么只有 5 个类型声明?
$file->name, //1
$file->size, //2
$file->type, //3
$file->url, //4
$file->title,//5
$file->description //6 共6个
);
警告:mysqli_stmt::bind_param():在类型定义字符串不匹配的绑定变量的元素个数
这还不清楚吗?
$query->bind_param(
' sisss', //怎么只有 5 个类型声明?
$file->name, //1
$file->size, //2
$file->type, //3
$file->url, //4
$file->title,//5
$file->description //6 共6个
);