我正在尝试重命名我通过 http POST 接受的文件。请看代码:
<?php
$xmlData = fopen('php://input' , 'rb');
while (!feof($xmlData)) { $xmlString .= fread($xmlData, 4096); }
fclose($xmlData);
file_put_contents('temp/message' . date('m-d-y') . '-' . time() . '.xml', $xmlString, FILE_APPEND);
$xml = new SimpleXMLElement($xmlString);
$id = trim($xml->MSG->ID);
$receiver = trim($xml->MSG->RECEIVER);
$message = trim($xml->MSG->MESSAGE);
$sender = trim($xml->MSG->SENDER);
$binary = trim($xml->MSG->BINARY);
$sent = trim($xml->MSG->SENT);
foreach ($xml->{'line-items'}->{'line-item'} as $lineItem) {
array_push($messageTitles, trim($lineItem->title));
}
header('HTTP/1.0 200 OK');
exit();
现在我对如何重命名这个有点不知所措?