请告诉我如何让用户在我的网站(PHP)中输入的反馈进入 Mantis。现在我正在通过电子邮件将反馈发送到我的 ID。
PS:我基本上是一个Java程序员。但我希望使用 PHP 完成此操作,因为该站点是使用 PHP 完成的。
Mantis 有一个 SOAP API,您可以使用它以编程方式与错误跟踪器交互。创建问题的简单实现(不针对 Mantis 实例进行双重检查)是
$c = new SoapClient("http://example.org/mantis/api/soap/mantisconnect.php?wsdl");
$username = 'xxx';
$password = 'xxx';
$issue = array ( 'summary' => 'My test issue' , 'description' => 'Some description');
$c->mc_issue_add($username, $password, $issue);
我无法让 Robert's 工作,因为我有两个存储问题的项目,因此它需要我提供项目 ID,我在项目下拉列表的 html 中找到了该 ID。
因此,我将罗伯特的回答向前迈进了一步,并添加了一些代码以允许提交到自定义字段。
这与最新的螳螂版本配合得很好。
$c = new SoapClient("http://www.yoursite.com/path_to_mantis/api/soap/mantisconnect.php?wsdl");
$username = 'user';
$password = 'pass';
$issue = array (
'summary' => 'Rone My test issue',
'description' => 'Rone Some description',
'project'=>array('id'=>2),
'category'=>'General',
'custom_fields'=>array(
array('field' => array('id'=>1,'name'=>'Account #'),'value'=>1),
array('field' => array('id'=>2,'name'=>'Account Name'),'value'=>'Name Goes here')
)
);
$c->mc_issue_add($username, $password, $issue);
对于您的设置,听起来 EmailReporting 插件将是最好的方法:
http://www.mantisbt.org/wiki/doku.php/mantisbt:emailreporting
以防万一有人遇到和我一样的麻烦。确保您使用正确的 utf8 fpr 用户名,尤其是密码(使用特殊字符和内容时):
$issue = $c->mc_issue_get($username, utf8_encode($password), $id);