- A+
所属分类:PHP
<?php function upload(array $files) { $ch = curl_init(); $options = array( CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_HEADER => true, CURLOPT_NOBODY => false, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_HTTPHEADER => [ 'Content-Type:multipart/form-data', 'Authorization:token' ], CURLOPT_URL => 'https://zhidao.loocode.com/upload', CURLOPT_TIMEOUT => 3, ); if (function_exists('curl_file_create')) { $post['file'] = curl_file_create($files['tmp_name'], $files['type'], $files['name']); } else { $post['file'] = '@' . $files['tmp_name'] . ';type=' . $files['type'] . ';filename=' . $files['name']; } $options[CURLOPT_POSTFIELDS] = $post; curl_setopt_array($ch, $options); return curl_exec($ch); }
- 我的微信
- 这是我的微信扫一扫
-
- 我的微信公众号
- 我的微信公众号扫一扫
-