【问题标题】:Edit my xml file using php使用 php 编辑我的 xml 文件
【发布时间】:2015-06-25 07:25:44
【问题描述】:

我想更新拨号标签并替换 +923455252632+923333578357 这是代码;

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Say voice="alice">Thanks for the call. Configure your number's voice U R L to change this message.</Say>
    <Pause length="1"/>
    <Say voice="alice">Let us know if we can help you in any way during your development. you are a good person </Say>
    <Dial>+923455252632</Dial>
</Response>

【问题讨论】:

  • 如果您只想这样做,请将 xml 保存为字符串并使用 str_replace
  • 我必须替换整个 xml 还是只替换一个拨号部分?

标签: php xml


【解决方案1】:

我找到了解决办法,就在这里。

$myfile = fopen("message.xml", "w") or die("Unable to open file!");// opens file in write mode @ftruncate($myfile, 0);// trancate previous contant in the xml file named message $txt = '<?xml version="1.0" encoding="UTF-8"?> <Response> <Say voice="alice"> Your call is being transferred to one of our company employees</Say> <Pause length="1"/> <Say voice="alice"> Please wait.</Say> <Pause length="1"/> <Say voice="alice"> Please wait.</Say> <Say voice="alice">Let us know if we can help you. you are a good person </Say> <Dial>'.$employee.'</Dial> </Response>'; fwrite($myfile, $txt);// Write contant in the file fclose($myfile);// Close file

【讨论】:

    猜你喜欢
    • 2011-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多