<tfoot id='IJode'></tfoot>
      <legend id='IJode'><style id='IJode'><dir id='IJode'><q id='IJode'></q></dir></style></legend>
      <i id='IJode'><tr id='IJode'><dt id='IJode'><q id='IJode'><span id='IJode'><b id='IJode'><form id='IJode'><ins id='IJode'></ins><ul id='IJode'></ul><sub id='IJode'></sub></form><legend id='IJode'></legend><bdo id='IJode'><pre id='IJode'><center id='IJode'></center></pre></bdo></b><th id='IJode'></th></span></q></dt></tr></i><div id='IJode'><tfoot id='IJode'></tfoot><dl id='IJode'><fieldset id='IJode'></fieldset></dl></div>

        <small id='IJode'></small><noframes id='IJode'>

          <bdo id='IJode'></bdo><ul id='IJode'></ul>

      1. 如何加载使用 PHP 生成的 SVG 文件?

        How do I load a SVG file that#39;s been generated with PHP?(如何加载使用 PHP 生成的 SVG 文件?)

        <small id='T8BTG'></small><noframes id='T8BTG'>

          <tbody id='T8BTG'></tbody>
          • <bdo id='T8BTG'></bdo><ul id='T8BTG'></ul>
            <tfoot id='T8BTG'></tfoot>
          • <i id='T8BTG'><tr id='T8BTG'><dt id='T8BTG'><q id='T8BTG'><span id='T8BTG'><b id='T8BTG'><form id='T8BTG'><ins id='T8BTG'></ins><ul id='T8BTG'></ul><sub id='T8BTG'></sub></form><legend id='T8BTG'></legend><bdo id='T8BTG'><pre id='T8BTG'><center id='T8BTG'></center></pre></bdo></b><th id='T8BTG'></th></span></q></dt></tr></i><div id='T8BTG'><tfoot id='T8BTG'></tfoot><dl id='T8BTG'><fieldset id='T8BTG'></fieldset></dl></div>
          • <legend id='T8BTG'><style id='T8BTG'><dir id='T8BTG'><q id='T8BTG'></q></dir></style></legend>

                1. 本文介绍了如何加载使用 PHP 生成的 SVG 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想用 PHP 创建一个 SVG 文件,然后将它包含在一个 HTML 文件中.这是我到目前为止所拥有的(遵循 本教程)

                  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:

                  <?php
                  header("Content-type: image/svg+xml");
                  ?>
                  <?xml version="1.0" encoding="iso-8859-1"?>
                  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
                  "http://www.w3.org/TR/2001/
                  REC-SVG-20010904/DTD/svg10.dtd">
                  
                  <svg width="310" height="140" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
                      <g style="stroke:black;fill:lightgreen" transform="translate(30,30)">
                          <rect x="10" y="10" width="100" height="30" style="stroke-width:4"/>
                          <circle cx="170" cy="25" r="20" style="stroke-width:4"/>
                          <line x1="265" y1="10" x2="200" y2="70" style="stroke-width:4"/>
                          <text x="80" y="90" style="font:size: 8">Basic shapes</text>
                      </g>
                  </svg>
                  

                  index.html

                  <!DOCTYPE html>
                  <html>
                  <head>
                  <style type="text/css">
                  html,body, #MOSVG { 
                      height: 100%; 
                      width: 100%;
                      padding:0;
                      margin:0;
                  }
                  </style>
                  </head>
                  <body>
                      <object data="svg.php" type="image/svg+xml" id="MOSVG" />
                  
                  </body>
                  </html>
                  

                  当我查看 index.html 时,我看到的只是一个空白页.控制台上没有警告/错误.Apache 错误日志(我正在使用 XAMPP)给出 [Mon Jul 09 14:36:15 2012] [error] [client 127.0.0.1] script 'C:/xampp/htdocs/svgtest/public/svg.php' 未找到或无法统计,引用者:http://localhost/svgtest/public/.它们在同一个目录中.

                  When I look at index.html all I see is a blank page. There's no warnings/errors on the console. Apache error logs (I'm using XAMPP) give [Mon Jul 09 14:36:15 2012] [error] [client 127.0.0.1] script 'C:/xampp/htdocs/svgtest/public/svg.php' not found or unable to stat, referer: http://localhost/svgtest/public/. They're in the same directory.

                  推荐答案

                  GeoPhoenix 在上面回答了,我想我会把它放到一个答案中,以便有一个官方的:

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

                  如果您删除 <?xml?> 行,它会呈现 svg

                  if you remove the <?xml?> line it renders the svg

                  由于 short-open-tag 设置(感谢 fvu).这是一个简单的修复,我刚刚替换了

                  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

                  <?xml version="1.0" encoding="iso-8859-1"?>
                  

                  <?php echo '<?xml version="1.0" encoding="iso-8859-1"?>';?>
                  

                  这具有相同的预期结果并且不会导致语法错误.

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

                  这篇关于如何加载使用 PHP 生成的 SVG 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                    <bdo id='wPtos'></bdo><ul id='wPtos'></ul>

                  • <small id='wPtos'></small><noframes id='wPtos'>

                      • <tfoot id='wPtos'></tfoot>
                          <legend id='wPtos'><style id='wPtos'><dir id='wPtos'><q id='wPtos'></q></dir></style></legend>

                          <i id='wPtos'><tr id='wPtos'><dt id='wPtos'><q id='wPtos'><span id='wPtos'><b id='wPtos'><form id='wPtos'><ins id='wPtos'></ins><ul id='wPtos'></ul><sub id='wPtos'></sub></form><legend id='wPtos'></legend><bdo id='wPtos'><pre id='wPtos'><center id='wPtos'></center></pre></bdo></b><th id='wPtos'></th></span></q></dt></tr></i><div id='wPtos'><tfoot id='wPtos'></tfoot><dl id='wPtos'><fieldset id='wPtos'></fieldset></dl></div>
                              <tbody id='wPtos'></tbody>