生成的header_html.php为
<?php
include_once "smarttemplate_extensions/smarttemplate_extension_header.php";
include_once "smarttemplate_extensions/smarttemplate_extension_current_time.php";?><?php
echo smarttemplate_extension_header("Content-type: image/svg+xml");
?>
<?xml version="1.0" ?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="300px" height="150px" style="shape-rendering:optimizeQuality;text-rendering:optimizeQuality">
<circle id="ball" cx="150" cy="75" r="50" style="fill:rgb(200,200,255)" />
<text x="70" y="82" id="title" style="font-face:Arial;font-size:12pt"><?php
echo $_obj['TITLE'];
?>
</text>
<text x="90" y="140" id="title" style="font-face:Arial;font-size:10pt">Created at <?php
echo smarttemplate_extension_current_time();
?>
</text>
</svg>
权且不说你的浏览器是否支持svg
单就<?xml version="1.0" ?>就可能有问题了
当short_open_tag=On时<? ?>间的内容被解释成php代码,而xml version="1.0" 显然是错误的
所以要运行这个例子,需要设置short_open_tag=off。也就是所有的php代码都要用<?php ?>标记括起,不能简写成<? ?>