Php lumen-文件\u获取\u内容给出HTTP\u内部\u服务器\u错误
在lumen中,我的代码如下所示,用于在api响应中发送文件内容,对于某些文档,它工作正常,但对于某些文档,它给出了HTTP\u INTERNAL\u SERVER\u错误Php lumen-文件\u获取\u内容给出HTTP\u内部\u服务器\u错误,php,laravel,lumen,internal-server-error,Php,Laravel,Lumen,Internal Server Error,在lumen中,我的代码如下所示,用于在api响应中发送文件内容,对于某些文档,它工作正常,但对于某些文档,它给出了HTTP\u INTERNAL\u SERVER\u错误 $content = base64_encode(file_get_contents($URL)); failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported 是否有任何解决方案或要求将php.ini设置为可验
$content = base64_encode(file_get_contents($URL));
failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported
是否有任何解决方案或要求将php.ini设置为可验证的
failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported
在web错误日志中,它给我的错误如下:
failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_URL, $data[$k]['doc_url']);
$data = curl_exec($ch);
curl_close($ch);
echo"<pre>";print_r($data);die;
为了解决这个问题,我在下面的帮助下获得了文件内容
failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported
$options = array(
'http' => array(
'protocol_version' => '1.0',
'method' => 'GET'
)
);
$context = stream_context_create($options);
它给我的错误是,无法打开流:路径中没有这样的文件或目录…可能是您试图访问的URL阻止了这样的方式,就像您试图从他们的服务器获取内容一样?
failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported
也许你应该在所有相关设置中使用卷曲。
我所知道的复制请求的最好方法是在chrome上打开开发者控制台,然后在“NewWork”选项卡上找到您试图模拟的请求。右键单击->复制->复制为CURL(cmd),然后将其粘贴到此处以接收等效的PHP CURL代码:
希望对你有所帮助,如果没有,你能告诉我你要去的目的地吗
failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported
祝您好运首先,您可以为此类请求设置上下文:
failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported
尝试按如下方式获取文件的路径:
failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported
祝你好运 检查web服务器错误日志,查看错误消息的实际内容。感谢您的回复,感谢您的建议我已编辑了我的问题,请检查此问题谢谢您的回答,我已使用它,未解决,我发现问题,问题是url中的空格,我已使用urlencode,但它不起作用,我已将空格替换为%20,它起作用了
failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported