PHP使用file_get_content设置头信息的方法具体如下:
$header = array( 'http' => array('header' => "Referer: http://www.apizl.comr\n" . "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36\r\n" . "", 'timeout' => 15 ), ); $context = stream_context_create($header ); $imageData = file_get_contents($imageFile, 0, $context);
关键字词: