我引用了 PHP 手册,但由于提前关闭 php 标记而出现语法错误 - 显然我是 php 的新手,但我只是试图将 xml 分配为 php 字符串。这里有什么问题?
<?php
$xmlstr = <<<XML //Need a clarification on '<<<XML' if possible
<?xml version='1.0' standalone='yes'?> //This is closing my php script and causing error
<details>
<detail>
<user>mcgraw</user>
<dateA>09/11/1973</dateA>
<inTime>9:00am</inTime>
<outTime>6:00pm</outTime>
<hours>9</hours>
<notes>Monday</notes>
</detail>
<detail>
<user>simpson</user>
<dateA>08/23/1983</dateA>
<inTime>9:00am</inTime>
<outTime>5:30pm</outTime>
<hours>8.5</hours>
<notes>Thursday</notes>
</detail>
</details>
XML;
?>