curl出现Deprecated: curl_setopt(): The usage of the @filename API for file uploading is deprecated. Pl
2016-06-28 16:05
609 查看
<pre name="code" class="php"><?php class IPTest extends PHPUnit_Framework_TestCase{ public function testUpload01(){ $file = __DIR__.'\assets\test.txt'; $post['file'] = '@'.$file;//非 PHP5.5 //$post['file'] = new CurlFile($file);//PHP 5.5 $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, false); //启用时会发送一个常规的POST请求,类型为:application/x-www-form-urlencoded,就像表单提交的一样。 curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch,CURLOPT_BINARYTRANSFER,true); curl_setopt($ch, CURLOPT_POSTFIELDS,$post); curl_setopt($ch, CURLOPT_URL, $GLOBALS['UPLOAD_URL']); $info= curl_exec($ch); curl_close($ch); if(curl_error($ch)) { $this -> assertTrue(false); } $res = json_decode($info, true); $this->assertEquals($except,$res[0]); } } ?>
相关文章推荐
- [置顶] OpenCV&OpenCL宏观预览
- nginx下载、windows系统安装、设置欢迎页
- makefile 获取shell命令的结果
- CentOS 7最小化安装后找不到‘ifconfig’命令——修复小提示
- tomcat8 下利用jconsole实现监控
- LINUX 常用命令集合
- tomcat 出现的PermGen Space问题
- linux常用命令
- 【linux】linux tomcat服务器跑项目
- Yocto令Linux羽化成蝶
- Linux下安装Scala
- ubuntu 安装apache2并配置cgi,搭建mimetex转化公式图片的服务
- Linux下搭建maven私服nexus3.x
- meave项目导入eclipse中并发布到tomcat上
- Linux/UNIX 定时任务 cron 详解
- .Net中的AOP读书笔记系列之AOP介绍
- Shell 编程
- Ubuntu默认防火墙安装、启用、配置、端口、查看状态相关信息(转)
- RHEL6换CentOS6的yum源步骤大全(附命令代码)
- 完美解读Linux中文件系统的目录结构