<?php
$requestBody = new HttpRequestMultipartBody();
// POST參數(shù)
$requestBody->add('name', 'php');
// 文件域,后臺用$_FILES['file']獲取,第二個參數(shù)為本地文件路徑,第三個參數(shù)為文件名
$requestBody->addFile('file', '/path/to/aaa.txt', 'aaa.txt');
$http = HttpRequest::newSession();
$response = $http->post('http://www.baidu.com/', $requestBody);
更多建議: