使用PHP生成SVG文件 [英] Generating SVG files using PHP

查看:1199
本文介绍了使用PHP生成SVG文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我试图为我的用户创建一些标签图片,显示他们获得的总点数。我正在尝试在一个php文件中编写SVG文件,该文件将添加动态内容,例如用户的要点。我想使用HTML < 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆