我有一个像这样的文件
myfile.tpl
{if !$smarty.action}
<div id="bar">
{/if}
....
我正在使用此命令将文件加载到mysql表中
CREATE TABLE mytable (col text);
LOAD DATA LOCAL INFILE 'myfile.tpl' INTO TABLE mytable FIELDS TERMINATED BY '' ENCLOSED BY '' ESCAPED BY '' LINES TERMINATED BY '\n' STARTING BY ''
当我使用SELECT * FROM mytable WHERE 1
时
结果是:
{if !$smarty.action} {/if}
它只是在输出中跳过<div id="bar">
。
答案 0 :(得分:0)
按照与您相同的步骤进行操作:
myfile.tpl
具有以下内容
{if !$smarty.action}
<div id="bar">
{/if}
创建表
CREATE TABLE mytable (col text);
加载数据
LOAD DATA LOCAL INFILE 'D:\\SO_Test\\myfile.tpl' INTO TABLE mytable
FIELDS TERMINATED BY '' ENCLOSED BY '' ESCAPED BY ''
LINES TERMINATED BY '\n' STARTING BY ''
查看数据返回
select * from mytable
运行MySQL版本
SHOW VARIABLES LIKE "%version%"
'innodb_version', '5.6.17'
'version', '5.6.17'