Generating SVG files using PHP

2019-08-06 03:32发布

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!

标签: php html svg
1条回答
戒情不戒烟
2楼-- · 2019-08-06 04:10

Using the following PHP code, I set the content type of the file to svg+xml:

<?php
    header('Content-Type: image/svg+xml');
?>
查看更多
登录 后发表回答