Composer 使用速度漫

Composer可以使用国内的镜像源,更新和下载速度都很快

全局使用此源

composer config -g repo.packagist composer https://packagist.phpcomposer.com

http://pkg.phpcomposer.com/

Curl 上传图片

Bash

curl -F --from=@/Users/zhouitpro/Downloads/xj.jpg http://www.baidu.com

PHP curl 上传图片

$ch = curl_init();
$data = array('name' => 'Foo', 'file' => '@/path/to/image.jpeg');
curl_setopt($ch, CURLOPT_URL, 'http://localhost/upload.php');
curl_setopt($ch, CURLOPT_POST, 1);
//CURLOPT_SAFE_UPLOAD defaulted to true in 5.6.0
//So next line is required as of php >= 5.6.0
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec($ch);