关于CURL上传问题
php
<?php $ch = curl_init(); $data = array('name' => 'Foo', 'file' => new \CURLFile(realpath('1.jpg'))); //绝对路径 curl_setopt($ch, CURLOPT_URL, 'http://localhost/post.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_exec($ch); ?>
假设我要上传的文件来自网络
网络文件图片URL如下:
http://7sbpxj.com1.z0.glb.clouddn.com/firstpage
我file = “网络文件”
那么该怎么写
防爆的氪金坚菊
10 years, 3 months ago