将CURL用于具有扩展的Unicode字符/阿拉伯语的文件名

时间:2019-06-17 16:09:29

标签: php curl unicode

在IIS 8.5上使用PHP 7.3.1

以下代码返回HTTP代码0

<?php
$filename = 'ث.mp3';

$file = curl_file_create($filename,'audio/mpeg',basename($filename));

$options = array(
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_POSTFIELDS => array('file' => $file)
);

$ch = curl_init("https://httpbin.org/post");
curl_setopt_array($ch, $options);

$data = curl_exec($ch);
$info = curl_getinfo($ch);

curl_close($ch);

echo $info['http_code'];

将第一行更改为$filename = test.mp3会使请求成功,并返回HTTP代码200

我收集到负责此行为的libcurl API-请参见https://bugs.php.net/bug.php?id=77262

除了重命名文件外,有人知道解决方法吗?

0 个答案:

没有答案
相关问题