我已经在我的codeignitore plategorme 中集成了mxGraph,但是当你尝试使用导出表单导出时,我在检查时收到错误500,我发现getimage 方法接收到我回溯处理的空值,发现该值不是空的,而是vml我发送的内容包含...并且我 mxgraph 的所有示例都具有...结构。有没有办法将我的 vml 转换为类似的
我有这个 PHP 代码来导出从 POST Methode 收到的 XML 代码
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Canvasexport extends MY_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
echo 'Index';
}
public function saveLocal()
{
include_once("libexport/src/mxServer.php");
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$xml = urldecode($_POST["xml"]);
$format = urldecode($_POST["format"]);
$filename = urldecode($_POST["filename"]);
$image = mxGraphViewImageReader::convert($xml, "#FFFFFF");
header("Content-Type: image/png");
echo mxUtils::encodeImage($image);
}
}
}
codeignator 显示此错误:
遇到 PHP 错误 严重性:错误
消息:在 null 上调用成员函数 getImage()
文件名:reader/mxGraphViewImageReader.php
行号:279
回溯:
我注意到我拥有的 XML 与他们在 MxGraph 示例中的示例文件不同。我的是这样的:
<mxGraphModel dx="1102" dy="603" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" background="#ffffff"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="2" value="" style="whiteSpace=wrap;html=1;aspect=fixed;fillColor=#B3B3B3;" parent="1" vertex="1"><mxGeometry x="333.5" y="230" width="80" height="80" as="geometry"/></mxCell><mxCell id="3" value="" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;size=0.16111111111111112;fillColor=#9999FF;" parent="1" vertex="1"><mxGeometry x="313.5" y="310" width="120" height="60" as="geometry"/></mxCell><mxCell id="4" value="" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;rotation=-180;size=0.16111111111111112;fillColor=#7EA6E0;" parent="1" vertex="1"><mxGeometry x="313.5" y="170" width="120" height="60" as="geometry"/></mxCell><mxCell id="5" value="<h1>Heading</h1><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>" style="text;html=1;strokeColor=none;fillColor=none;spacing=5;spacingTop=-20;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1"><mxGeometry x="278.5" y="440" width="190" height="120" as="geometry"/></mxCell><mxCell id="6" value="&laquo;interface&raquo;<br><b>Name</b>" style="html=1;fillColor=#B3B3B3;" parent="1" vertex="1"><mxGeometry x="130" y="80" width="110" height="50" as="geometry"/></mxCell><mxCell id="15" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;jettySize=auto;orthogonalLoop=1;" parent="1" source="7" target="11" edge="1"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="7" value="Classname" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;swimlaneFillColor=#ffffff;" parent="1" vertex="1"><mxGeometry x="100" y="320" width="140" height="104" as="geometry"/></mxCell><mxCell id="8" value="+ field: type" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="7" vertex="1"><mxGeometry y="26" width="140" height="26" as="geometry"/></mxCell><mxCell id="9" value="+ field: type" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="7" vertex="1"><mxGeometry y="52" width="140" height="26" as="geometry"/></mxCell><mxCell id="10" value="+ field: type" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="7" vertex="1"><mxGeometry y="78" width="140" height="26" as="geometry"/></mxCell><mxCell id="11" value="Classname" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=26;fillColor=none;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;swimlaneFillColor=#ffffff;" parent="1" vertex="1"><mxGeometry x="590" y="320" width="140" height="104" as="geometry"/></mxCell><mxCell id="12" value="+ field: type" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="11" vertex="1"><mxGeometry y="26" width="140" height="26" as="geometry"/></mxCell><mxCell id="13" value="+ field: type" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="11" vertex="1"><mxGeometry y="52" width="140" height="26" as="geometry"/></mxCell><mxCell id="14" value="+ field: type" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=top;spacingLeft=4;spacingRight=4;overflow=hidden;rotatable=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;" parent="11" vertex="1"><mxGeometry y="78" width="140" height="26" as="geometry"/></mxCell><mxCell id="16" value="Transaction" style="shape=ext;rounded=1;html=1;whiteSpace=wrap;double=1;fillColor=#B3B3B3;" parent="1" vertex="1"><mxGeometry x="100" y="200" width="120" height="80" as="geometry"/></mxCell><mxCell id="18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;exitX=0.25;exitY=0.2;exitPerimeter=0;jettySize=auto;orthogonalLoop=1;" parent="1" source="17" target="11" edge="1"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="17" value="" style="shape=parallelMarker;html=1;fillColor=#B3B3B3;" parent="1" vertex="1"><mxGeometry x="530" y="160" width="70" height="70" as="geometry"/></mxCell></root></mxGraphModel>
使用mxGraphModel标签而不是他们的图形标签,如下所示:
<graph label="My Diagram" x="90" y="50" width="400" height="280">