【发布时间】:2019-11-04 05:58:01
【问题描述】:
在流明中,我的代码在下面以 api 响应发送文件内容,对于某些文档它工作正常,但对于某些文档它给出 HTTP_INTERNAL_SERVER_ERROR 错误
$content = base64_encode(file_get_contents($URL));
Symfony\Component\HttpKernel\Exception\HttpException 对象
(
[状态代码:Symfony\Component\HttpKernel\Exception\HttpException:private] => 500
[标题:Symfony\Component\HttpKernel\Exception\HttpException:private] => 数组
(
)
[message:protected] => HTTP_INTERNAL_SERVER_ERROR
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => D:\xampp7.1\htdocs\PROJECT_NAME\app\Exceptions\Handler.php
[line:protected] => 76
[trace:Exception:private] => Array
( ...
是否有任何解决方案或需要设置php.ini veriable??
在网络错误日志中,它给了我类似的错误,
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;
它给了我没有文件连接的空输出
我还添加了以下代码
$content = base64_encode(file_get_contents(urlencode($data[$k]['doc_url'])));
$data[$k]['doc_content'] = "$content";
它给了我错误,无法打开流:PATH 中没有这样的文件或目录...
【问题讨论】:
-
检查网络服务器错误日志,看看错误信息到底是什么。
-
感谢您的回复,您的建议我已经编辑了我的问题,请检查此
标签: php laravel lumen internal-server-error