我已经在我的codeignitore plategorme中集成了mxGraph但是当你尝试使用导出表单导出时,我在检查时得到错误500我发现getimage方法接收s null值我跟踪处理并发现该值不为空但我发送的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">