我在用dhtmlx控件进行开发的时候,需要解析的xml文件出现以下异常,如何解决? <b>Parse error</b>: syntax error, unexpected T_STRING in <b>/usr/local/waf7-web/waf7web/app/views/route/get_route_xml.thtml</b> on line <b>1</b><br />
其中get_route_xml.thtml文件内容如下:<?xml version="1.0" encoding="UTF-8"?>
<rows>
<?php
foreach ($croutes as $key => $route) {
?>
<row id="<?php echo $key; ?>">
<userdata name="nh_type"><?php echo $route['nh_type']; ?></userdata>
<cell><?php echo $key; ?></cell>
<cell><![CDATA[<?php echo $route['dst_ip']; ?>]]></cell>
<cell><![CDATA[<?php echo $route['distance']; ?>]]></cell>
<cell><![CDATA[<?php echo $route['nh_ip']; ?>]]></cell>
<cell><![CDATA[<?php echo $route['weigh']; ?>]]></cell>
</row>
<?php
}
?>
</rows>
其中get_route_xml.thtml文件内容如下:<?xml version="1.0" encoding="UTF-8"?>
<rows>
<?php
foreach ($croutes as $key => $route) {
?>
<row id="<?php echo $key; ?>">
<userdata name="nh_type"><?php echo $route['nh_type']; ?></userdata>
<cell><?php echo $key; ?></cell>
<cell><![CDATA[<?php echo $route['dst_ip']; ?>]]></cell>
<cell><![CDATA[<?php echo $route['distance']; ?>]]></cell>
<cell><![CDATA[<?php echo $route['nh_ip']; ?>]]></cell>
<cell><![CDATA[<?php echo $route['weigh']; ?>]]></cell>
</row>
<?php
}
?>
</rows>
要用php语句输出
echo '<?xml version="1.0" encoding="UTF-8"?>';
; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
; NOTE: Using short tags should be avoided when developing applications or
; libraries that are meant for redistribution, or deployment on PHP
; servers which are not under your control, because short tags may not
; be supported on the target server. For portable, redistributable code,
; be sure not to use short tags.
short_open_tag = Off