日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

php jira,php – 为Jira的api添加附件

發布時間:2025/3/19 47 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php jira,php – 为Jira的api添加附件 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

我正在嘗試使用他們的API將文件附加到Jira案例.我在Drupal 6(

PHP v.5.0)中這樣做.這是我的代碼:

$ch = curl_init();

$header = array(

'Content-Type: multipart/form-data',

'X-Atlassian-Token: no-check'

);

$attachmentPath = $this->get_file_uploads();

//$attachmentPath comes out to be something like:

//http://localhost/mySite/web/system/files/my_folder/DSC_0344_3.JPG

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

$url= 'https://mysite.atlassian.net/rest/api/2/issue/20612/attachments/';

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_VERBOSE, 1);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

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

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS ,$data);

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_USERPWD, "myusername:mypassword");

$result = curl_exec($ch);

$ch_error = curl_error($ch);

問題是$result表示為false,$ch_error表示無法打開文件.這個錯誤是否與Drupal有關或與我如何向Jira發送請求有關?順便說一句,如果我使用絕對路徑,但是,像這樣:

$attachmentPath = 'C:\wamp\www\mySite\web\sites\mySite.net\files\my_folder\DSC_0333.JPG';

上傳工作正常.

總結

以上是生活随笔為你收集整理的php jira,php – 为Jira的api添加附件的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。