How do I load a SVG file that's been generated with PHP?

前端 未结 1 1058
悲&欢浪女
悲&欢浪女 2021-01-06 02:26

I want to create a SVG file with PHP, and then include it in a HTML file. Here\'s what I have so far (following this tutorial)

svg.php:

<         


        
1条回答
  •  感情败类
    2021-01-06 03:09

    GeoPhoenix answered above, I figured I'd put it into an answer so that there's an offical one:

    if you remove the line it renders the svg

    PHP can see as the opening tag for PHP code (rather than an XML declaration), thanks to the short-open-tag setting (thanks to fvu). This is an easy fix, I just replaced

    
    

    with

    ';?>
    

    This has the same intended result and doesn't cause syntax errors.

    0 讨论(0)
提交回复
热议问题