PHP curl_file_create函数
PHP 教程
· 2019-01-23 12:13:49
(PHP 5 >= 5.5.0)
curl_file_create — 创建一个 CURLFile 对象。
说明
CURLFile curl_file_create ( string $filename [, string $mimetype [, string $postname ]] )
创建一个 CURLFile 对象, 用与上传文件。
参数
filename
上传文件的路径
mimetype
文件的Mimetype
postname
文件名。
返回值
返回 CURLFile 对象。
实例
curl_file_create() 实例
<?php
/* http://example.com/upload.php:
<?php var_dump($_FILES); ?>
*/
// 创建一个 cURL 句柄
$ch = curl_init('http://example.com/upload.php');
// 创建一个 CURLFile 对象
$cfile = curl_file_create('cats.jpg','image/jpeg','test_name');
// 设置 POST 数据
$data = array('test_file' => $cfile);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// 执行句柄
curl_exec($ch);
?>
以上例程会输出:
array(1) {
["test_file"]=>
array(5) {
["name"]=>
string(9) "test_name"
["type"]=>
string(10) "image/jpeg"
["tmp_name"]=>
string(14) "/tmp/phpPC9Kbx"
["error"]=>
int(0)
["size"]=>
int(46334)
}
}
点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html
ggplot2:数据分析与图形艺术
哈德利·威克姆 (Hadley Wickham) / 统计之都 / 西安交通大学出版社 / 2013-5-1 / CNY 46.00
中译本序 每当我们看到一个新的软件,第一反应会是:为什么又要发明一个新软件?ggplot2是R世界里相对还比较年轻的一个包,在它之前,官方R已经有自己的基础图形系统(graphics包)和网格图形系统(grid包),并且Deepayan Sarkar也开发了lattice包,看起来R的世界对图形的支持已经足够强大了。那么我们不禁要问,为什么还要发明一套新的系统? 设计理念 打个比......一起来看看 《ggplot2:数据分析与图形艺术》 这本书的介绍吧!
JS 压缩/解压工具
在线压缩/解压 JS 代码
html转js在线工具
html转js在线工具