我正在研究Redmine API,用于在PHP中创建和更新票证 我必须在一个帐户上兑换我可以成功创建票证的帐户,但在第二个帐户上我什至没有收到任何错误但甚至无法创建票证,但是在第二个帐户上,当我尝试上传图像令牌时票证未生成不生成。
我正在使用的API https://github.com/kbsali/php-redmine-api
在这两个地方看起来都一样,为什么我不能创建票证,而在第二个系统中,当第一个在第一位工作时,请仔细看一下我的代码
Working and tickets creating and attachment uploading on redmine successfully
require_once 'vendor/autoload.php';
define('UPLOAD_DIR', 'uploads/');
$fileNames=uniqid() . '.png';
$img = $_POST['base64'];
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . $fileNames;
$success = file_put_contents($file, $data);
$client = new Redmine\Client('http://redmine.working.com', 'outlander', '857783hg');
print_r(client);
$upload = json_decode( $client->api('attachment')->upload($file) );
$client->user->all();
$client->user->listing();
$client->issue->create([
'project_id' => 'project-xyz',
'subject' => $_POST['subjectIs'],
'description' => 'Client Name: '.$_POST['clientNames'].'==>'.$_POST['descriptionIs'],
'assigned_to_id' => '31',
'priority_id' => $_POST['inputPriority'],
'uploads' => array(
array(
'token' => $upload->upload->token,
'filename' => $file,
'description' => 'This is my file description',
'content_type'=> 'image/png'
)
)
]);
client print data
Redmine\Client Object
(
[port:Redmine\Client:private] => 80
[url:Redmine\Client:private] => http://redmine.abc.com
[apikeyOrUsername:Redmine\Client:private] => outlander
[pass:Redmine\Client:private] => 857783hg
[checkSslCertificate:Redmine\Client:private] =>
[checkSslHost:Redmine\Client:private] =>
[sslVersion:Redmine\Client:private] => 0
[useHttpAuth:Redmine\Client:private] => 1
[apis:Redmine\Client:private] => Array
(
)
[impersonateUser:protected] =>
[customHost:protected] =>
[responseCode:Redmine\Client:private] =>
[curlOptions:Redmine\Client:private] => Array
(
)
[classes:Redmine\Client:private] => Array
(
[attachment] => Attachment
[group] => Group
[custom_fields] => CustomField
[issue] => Issue
[issue_category] => IssueCategory
[issue_priority] => IssuePriority
[issue_relation] => IssueRelation
[issue_status] => IssueStatus
[membership] => Membership
[news] => News
[project] => Project
[query] => Query
[role] => Role
[time_entry] => TimeEntry
[time_entry_activity] => TimeEntryActivity
[tracker] => Tracker
[user] => User
[version] => Version
[wiki] => Wiki
[search] => Search
)
)
不工作,票证未创建,附件上传未创建令牌为空的响应
require_once 'vendor/autoload.php';
define('UPLOAD_DIR', 'uploads/');
$fileNames=uniqid() . '.png';
$img = $_POST['base64'];
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . $fileNames;
$success = file_put_contents($file, $data);
$client = new Redmine\Client('http://redmine.notworking.com', 'nwoutlout', 'K!3.sFAA5;=3');
print_r(client);
$upload = json_decode( $client->api('attachment')->upload($file) );
$client->user->all();
$client->user->listing();
$client->issue->create([
'project_id' => 'project-xyz',
'subject' => $_POST['subjectIs'],
'description' => 'Client Name: '.$_POST['clientNames'].'==>'.$_POST['descriptionIs'],
'assigned_to_id' => '31',
'priority_id' => $_POST['inputPriority'],
'uploads' => array(
array(
'token' => $upload->upload->token,
'filename' => $file,
'description' => 'This is my file description',
'content_type'=> 'image/png'
)
)
]);
Client print data of url not working
Redmine\Client Object
(
[port:Redmine\Client:private] => 80
[url:Redmine\Client:private] => http://redmine.notworking.com
[apikeyOrUsername:Redmine\Client:private] => nwoutlout
[pass:Redmine\Client:private] => K!3.sFAA5;=3
[checkSslCertificate:Redmine\Client:private] =>
[checkSslHost:Redmine\Client:private] =>
[sslVersion:Redmine\Client:private] => 0
[useHttpAuth:Redmine\Client:private] => 1
[apis:Redmine\Client:private] => Array
(
)
[impersonateUser:protected] =>
[customHost:protected] =>
[responseCode:Redmine\Client:private] =>
[curlOptions:Redmine\Client:private] => Array
(
)
[classes:Redmine\Client:private] => Array
(
[attachment] => Attachment
[group] => Group
[custom_fields] => CustomField
[issue] => Issue
[issue_category] => IssueCategory
[issue_priority] => IssuePriority
[issue_relation] => IssueRelation
[issue_status] => IssueStatus
[membership] => Membership
[news] => News
[project] => Project
[query] => Query
[role] => Role
[time_entry] => TimeEntry
[time_entry_activity] => TimeEntryActivity
[tracker] => Tracker
[user] => User
[version] => Version
[wiki] => Wiki
[search] => Search
)
)
我正在使用的API https://github.com/kbsali/php-redmine-api
在这两个地方看起来都一样,那为什么为什么我不能在第二个系统中创建票证,而第一个系统却在第一位工作,