Php代码
- <?php
- $domain = "DOMAIN";
- $username = "USERNAME";
- $owner = "OWNER" ;
- $template = "TEMPLATE" ;
- $description = "DESCRIPTION" ;
- $topics = "TOPICS" ;
- $subject = "SUBJECT" ;
- $xmlstr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n
- <batchcommands>\n
- \n </batchcommands>";
- $xml = new SimpleXMLElement($xmlstr);
- $create = $xml->addchild('create');
- $mailing_list = $create->addchild('mailing_list');
- $mailing_list->addAttribute('domain', ($domain));
- $mailing_list->addAttribute('username', ($username));
- $mailing_list->addChild('owner', $owner);
- $mailing_list->addChild('template', $template);
- $mailing_list->addChild('description', $description);
- $mailing_list->addChild('topics', $topics);
- $mailing_list->addChild('subject', $subject);
- $xml->asXML("C:/create.xml");
- ?>
生成文件内容:
- <?xml version="1.0" encoding="UTF-8"?>
- <batchcommands>
- <create>
- <mailing_list domain="DOMAIN" username="USERNAME">
- <owner>OWNER</owner>
- <template>TEMPLATE</template>
- <description>DESCRIPTION</description>
- <topics>TOPICS</topics>
- <subject>SUBJECT</subject>
- </mailing_list>
- </create>
- </batchcommands>