Yes, another one of these T_STRING errors...but hopefully this one is different.
Here is all the code I have on my page:
<?php
?>
<?xml version="1.0" encoding="UTF-8" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/开发者_StackOverflow社区sitemap/0.9">
</urlset>
As you can probably see, I'm trying to do a sitemap for my site. But I didn't put anything on it and I already have a
Parse error: syntax error, unexpected T_STRING in ..../sitemap.php on line 4
Which points to the end of PHP code marking ?>
Any input much appreciated. Thanks.
Try
<?php
echo '<?xml version="1.0" encoding="UTF-8" ?> ';
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
</urlset>
http://sandbox.phpcode.eu/g/4a51c
problem are these php tags, open-short-tags are probably allowed on your server
There is no reason to include/require XML in PHP.
Proper handling of XML should always use XML handling function/class like
- SimpleXML
- DOMDocument
精彩评论