我有一个像这样的xml文件:
的test.xml
<?xml version="1.0" encoding="utf-8" ?>
<plugin name="tree">
<title>Test</title>
<description>some description</description>
<files>
<file>test.tmp</file>
</files>
<install><![CDATA[
global $test;
]]></install>
<hooks>
<hook name="hookname"><![CDATA[
global $local;
]]></hook>
</hooks>
<phrases>
<phrase key="category"><![CDATA[Show categories]]></phrase>
</phrases>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我喜欢将它导入MySQL表,如'mytable'
CREATE TABLE mytable (plugin varchar(255),title varchar(255),description varchar(255), file varchar(255),install varchar(255),hook varchar(255),phrase varchar(255));
Run Code Online (Sandbox Code Playgroud)
我使用下面的命令
LOAD XML LOCAL INFILE 'test.xml'
INTO TABLE mytable(plugin,title,description,file,install,hook,phrase);
Run Code Online (Sandbox Code Playgroud)
它运行成功,但有0行!
查询已成功实施,0行已受影响.
谢谢