定制 imnotjames/curlfile-compat 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

imnotjames/curlfile-compat

最新稳定版本:0.0.1

Composer 安装命令:

composer require imnotjames/curlfile-compat

包简介

Compatibility library with CURLFile from PHP 5.5

README 文档

README

Build Status Coverage Status

Compatibility library to add a CURLFile class to older versions of PHP. The RFC has some more information on it as well.

This class abuses the fact that the PHP CURLOPT_POSTFIELDS option will coerce classes to strings when sending it as data, and outputs the older style of including files in the post data.

Installation

New school or old school, your choice.

For a new school installation with Composer simply add it to your list of dependencies.

If you're kicking it old school you've got to require src/CURLFile.php and src/imnotjames/CURLFILE.php.

Either way, the non-namespaced CURLFile will only be created if the class doesn't already exist. Same goes for the create_curl_file function.

Usage

Exactly the same as PHP's CURLFile'

$handle = curl_init('http://example.com');

$cfile = new CURLFile('puppy.jpg','image/jpeg','puppy_boquet');

// Assign POST data
$data = array('test_file' => $cfile);

curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);

curl_exec($handle);

统计信息

  • 总下载量: 4.75k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-06-28