Lorsque vous produisez d'autres contenus que HTML avec PHP, il faut veiller à deux choses:
print('<?xml version="1.0" encoding="iso-8859-1"?>' . "\n");
print('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/PR-SVG-20010719/DTD/svg10.dtd">' . "\n");
<?php
header("Content-type: image/svg+xml");
print('<?xml version="1.0" encoding="iso-8859-1"?>' . "\n");
print('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/PR-SVG-20010719/DTD/svg10.dtd">' . "\n");
echo "<svg xmlns='http://www.w3.org/2000/svg'>\n";
print ('<rect x="50" y="50" rx="5" ry="5" width="200" height="100" style="fill:#CCCCFF;stroke:#000099"/>' . "\n");
print('</svg>' . "\n");
?>
// header ("Content-type: application/xml");
header ("Content-type: application/xhtml+xml");
echo '<?xml version="1.0" encoding="ISO-8859-1" ?>';
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg" >';
.....
.... echo "<p> ceci est du html </p>";
....
echo "<svg xmlns='http://www.w3.org/2000/svg'
xmlns:xlink='http://www.w3.org/1999/xlink'
height='100' width='200' x='200' y='0'>";
<circle fill='#183952' r='10' />
echo "</svg>