$ch = curl_init('http://127.0.0.0/upload');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
  'file' => new \CURLFile($_FILES['file']['tmp_name'])
]);

$result = curl_exec($ch);

if ($result === false) {
  $this->error("upload - FAILED");
}

$res = json_decode($result, true);

© 本文著作权归作者所有。转载请联系授权,禁止商用。