-1
我在php中生成以下xml。如何將屬性添加到xml節點?
PHP代碼: -
header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='UTF-8'?>";
echo "<Response>";
echo "<Dial>";
echo $client_no;
echo "</Dial>";
echo "<Say>The call failed or the remote party hung up. Goodbye.</Say>";
echo "</Response>";
輸出: -
<Response>
<Dial>919880022477</Dial>
<Say>
The call failed or the remote party hung up. Goodbye.
</Say>
</Response>
現在我想屬性添加到撥號節點。 是這樣的: -
<Dial callerId="jitu">919880022477</Dial>
你把所有精力投入到自己想出來的? –