我正在使用 PHP 版本 5.6 。我制作了一个 PHP 表单,有 3 个字段:用户名、密码和 CSV 文件上传。CSV 文件每行包含两个“数字代码”,票号和发票号除以“;” ,这样 CSV 有两列。在我编写的处理代码中,我编写了逐行读取 CSV 文件并将票号和发票号分解为两个变量的代码。之后,代码生成需要通过 GenericTicketConnectorSOAP 发送的 XML 数据并执行票证更新。我的 php 代码如下:
$URL = 'http://localhost/otrs/nphgenericinterface.pl/Webservice/GenericTicketConnectorSOAP';
$NameSpace = 'http://www.otrs.org/TicketConnector/';
// SOAP parameters
$parameters = [
'proxy_host' => $URL,
'proxy_port' => 8080,
'stream_context' => stream_context_create(
array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
)
)
)
];
// More code that it is not necessary to post it
//Posting the code that the problem starts
if(move_uploaded_file($_FILES['file']['tmp_name'],($path . $newfilename))){
echo '<div class="alert alert-primary" role="alert"><p>Success: File uploaded.</p></div>';
$fn = fopen($path . $newfilename,"r");
while(! feof($fn) ) {
$content = fgets($fn);
// Divide the ticket number and the invoice number into two variables
list($ticketnumber,$invoicenumber) = explode(";", $content);
echo "TicketNumber: ".$ticketnumber." Invoicenumber: ".$invoicenumber;
// Making XMLData
HUH函数