"file_get_contents(http://127.0.0.1:8000/storage/config/xxx.ini): failed to open stream: HTTP request failed! "
"file_get_contents(http://127.0.0.1:8000/storage/config/xxx.ini): failed to open stream: HTTP request failed! "
我在尝试通过 POST 方法发送表单数据 post 请求时收到此错误消息。
"file_get_contents(http://127.0.0.1:8000/storage/config/xxx.ini): failed to open stream: HTTP request failed! "
Laravel代码
$client = new \GuzzleHttp\Client();
$options = [
'form_params' => [
'service_id' => $id,
'email' => auth()->user()->email
],
'multipart' => [
[
'name' => 'file',
'contents' => file_get_contents('http://127.0.0.1:8000/storage/config/'.$service->config, 'r' ),
'filename' => $service->config
]
]
];
$response = $client->post('http://127.0.0.1:5000/run', $options);
顺便说一下,如果我在 URL 查看,文件就存在。有什么想法吗?
不要发出 http 请求来读取文件,而是使用 storage_path
帮助程序:
'contents' => file_get_contents(storage_path('config/'.$service->config, 'r' )),
我在尝试通过 POST 方法发送表单数据 post 请求时收到此错误消息。
"file_get_contents(http://127.0.0.1:8000/storage/config/xxx.ini): failed to open stream: HTTP request failed! "
Laravel代码
$client = new \GuzzleHttp\Client();
$options = [
'form_params' => [
'service_id' => $id,
'email' => auth()->user()->email
],
'multipart' => [
[
'name' => 'file',
'contents' => file_get_contents('http://127.0.0.1:8000/storage/config/'.$service->config, 'r' ),
'filename' => $service->config
]
]
];
$response = $client->post('http://127.0.0.1:5000/run', $options);
顺便说一下,如果我在 URL 查看,文件就存在。有什么想法吗?
不要发出 http 请求来读取文件,而是使用 storage_path
帮助程序:
'contents' => file_get_contents(storage_path('config/'.$service->config, 'r' )),