problem description
request the interface of java. One of the parameters is multiple files, but no matter how I request it, the return value is empty. Have you ever solved any related problems?
the environmental background of the problems and what methods you have tried
I try to send the file file with curl_file_create and new CURLFile (realpath ($url)). I don"t know if it is not recognized by Java or my side. The following code is shown in the figure above
.related codes
/ / Please paste the code text below (do not replace the code with pictures)
Java Interface document:
Request:
required remarks for Parameter name Type
token String / token Information
rfId int / Supplementary data order ID
maintainRepayFiles file / Supplementary data FileResponse:
Parameter name Class Type
errno String / Response status Codemsg String prompt
orderCode String order number
curl code of PHP on my side
$uri = C("JAVA_API").$uri;
//
$file = explode(",",$param["maintainRepayFiles"]);
foreach ($file as $key=>$url){
//$file[$key] = curl_file_create($url);
$file[$key] = new \CURLFile(realpath($url));
}
$param["maintainRepayFiles"] = $file;
$result = simple_curl($uri, $param);
dump($uri);
dump($param);
dump($result);
die;
request parameters and print results:
http://192.168.1.130:18080/cheduo/h5/wz/repay/order/files
Array
(
[token] => F4A6AD0BFA8D7B600525396389E7D0E6E0234FDDCC7AF
[rfId] => 27
[maintainRepayFiles] => Array
(
[0] => CURLFile Object
(
[name] =>
[mime] =>
[postname] =>
)
)
)
< H1 > Note: the file address ($url) is a url < / H1 >