使用PHP生成SVG文件 [英] Generating SVG files using PHP
本文介绍了使用PHP生成SVG文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< image>
标签从文件 image_gen.php
中获取SVG。 如何通过< image>
标签显示SVG?
感谢!
解决方案
使用以下PHP代码,我将文件的内容类型设置为<
$ b $ p $ <?php
header($ c $ s $ g $ b $ 'Content-Type:image / svg + xml');
?>
So, I'm attempting to create some tag images for my users, showing the total points that they have earned. I am attempting to write the SVG in a php file which will add in dynamic content, such as the user's points. I'd like to use a HTML <image>
tag to fetch the SVG from a file image_gen.php
.
How would I display the SVG through the <image>
tag?
Thanks!
解决方案
Using the following PHP code, I set the content type of the file to svg+xml
:
<?php
header('Content-Type: image/svg+xml');
?>
这篇关于使用PHP生成SVG文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文