我创建了一个代码以在数据库中插入图像。但是它不起作用。以下是我的代码...
$member_image_names = array_map( 'sanitize_file_name', $_FILES['member_image']['name'] );
foreach ( $member_image_names as $member_image_name ) {
$member_image_ext = strtolower( end( explode( '.', $member_image_name ) ) );
$member_image_newname[] = get_current_user_id() . $_SESSION['project_id'] . "_" . time() . "_" . mt_rand() . "." .$member_image_ext;
}
如果我给print_r($member_image_newname);
命令,我会得到正确的输出,如Array ( [0] => 21641_1531107789_1022196085.png [1] => 21641_1531107789_1879386984.png )
但是当我尝试将其插入数据库时,仅插入文件名而未插入扩展名...在数据库中插入的数据为{"member_image":["21641_1531107789_1022196085.","21641_1531107789_1879386984."]}
,我无法确定为为什么会这样。请帮我...谢谢...