使用服务器端脚本(PHP)创建SVG图形 [英] Creating SVG graphics using a server side script (PHP)
问题描述
有没有一种方法可以使用嵌入了SVG的PHP脚本来生成HTML文件,而SVG本身是由PHP脚本动态生成的?
Is there a way to generate an HTML file using a PHP script which has an SVG embedded where the SVG itself is dynamically generated by the PHP script?
基本上,我想向客户端显示动态生成的SVG图像,但是<embed>
,<object>
和<iframe>
仅引用外部源,而PHP仅生成当前HTML页面(而不是外部源) )
Basically, I want to display a dynamically generated SVG image to a client but <embed>
, <object>
as well as <iframe>
only refer to external sources while PHP generates the current HTML page only (and not the external sources)
还有,我可以在当前DOM中一一添加SVG元素的情况下,是否可以使用Javascript解决方案?
Further, is there a Javascript solution possible where I add SVG elements in the current DOM one by one?
推荐答案
尝试像这样链接到您的php文件:<object href=svg_generator.php> <!-- other attributes necessary for embedding svg not listed here -->
Try linking to your php file like this: <object href=svg_generator.php> <!-- other attributes necessary for embedding svg not listed here -->
这篇关于使用服务器端脚本(PHP)创建SVG图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!