且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将附件添加到 Jira 的 api

更新时间:2022-06-20 10:10:03

这应该适合你:

$data = array('file'=>"@". $attachmentPath . ';filename=test.png');

这是 cURL PHP https://bugs.php.net/bug.php?id=48962(在您看到的评论中,它已被修复)

This was a bug with cURL PHP <5.2.10, you can see this in the PHP bug tracker: https://bugs.php.net/bug.php?id=48962 (And in the comments you see, that it has been fixed)

如果你使用 PHP 5.5.0+,你可以使用这个:

And if you use PHP 5.5.0+ you can use this:

$cfile = new CURLFile($attachmentPath);
$cfile->setPostFilename('test.png');
$data = array('file'=>$cfile);

您也可以在 JIRA 评论中看到这一点:JIRA 评论

You can also see this in a JIRA comment: JIRA Comment

另外我认为你想改变这个:

Also i think you want to change this:

curl_setopt($ch, CURLOPT_HTTPHEADER, $this->get_jira_headers());

为此:

curl_setopt($ch, CURLOPT_HTTPHEADER, $header);