Php 如何使用文件获取内容获取图像数据

Php 如何使用文件获取内容获取图像数据,php,mysql,web-services,Php,Mysql,Web Services,尝试使用stream\u get\u content函数代替file\u get\u content。如果您得到资源类型 $profile\u image=stream\u get\u content('php://input'); <?php include("apiconfig.php"); global $api_key; foreach($_REQUEST as $k=>$val) { $_REQUEST[$k]=input_c

尝试使用stream\u get\u content函数代替file\u get\u content。如果您得到资源类型

$profile\u image=stream\u get\u content('php://input');

    <?php
include("apiconfig.php");
global $api_key;
foreach($_REQUEST as $k=>$val)
        {
            $_REQUEST[$k]=input_clean_string( $val);
        }
if(isset($_REQUEST['api_key']) && !empty($_REQUEST['api_key']) && $_REQUEST['api_key']==$api_key && isset($_REQUEST['user_id']) && !empty($_REQUEST['user_id'])  ){
$user_id=$_REQUEST['user_id'];
$profile_image=file_get_contents('php://input');


if ($profile_image) {

    $sql="UPDATE users SET profile_image='".$profile_image."' WHERE user_id=".$user_id;
    mysql_query($sql);
}
echo $user= get_userdata($user_id); 
}else{

echo json_encode(array('errormsg' => 'Invalid access.'));

}