load data local infile报错,大神帮忙看看吧

浏览:90 发布日期:2019/07/13 分类:求助交流
一个导入数据库的sql语句,直接在mysql里运行是正确的,但是到了thinkphp用原生sql就报错,大神帮忙看看吧?感激不尽

sql语句如下: 
load data local infile '/Library/WebServer/Documents/jfpt/Public/Upload/Bank/Temp/network.csv' IGNORE into table bank_network fields terminated by ',' lines TERMINATED by '\r\n' IGNORE 1 lines (node,wdname,status)
thinkphp里代码如下:public function test(){
        $a="load data local infile '/Library/WebServer/Documents/jfpt/Public/Upload/Bank/Temp/network.csv' IGNORE into table bank_network fields terminated by ',' lines TERMINATED by '\\r\\n' IGNORE 1 lines (node,wdname,status)";
        $t=M();
        $t->execute($a);
    }
报错如下:
:(

: [ SQL语句 ] : load data local infile '/Library/WebServer/Documents/jfpt/Public/Upload/Bank/Temp/network.csv' IGNORE into table bank_network fields terminated by ',' lines TERMINATED by '\r\n' IGNORE 1 lines (node,wdname,status)
错误位置
FILE: /Library/WebServer/Documents/jfpt/ThinkPHP/Library/Think/Db/Driver.class.php  LINE: 336

TRACE
#0 /Library/WebServer/Documents/jfpt/ThinkPHP/Library/Think/Db/Driver.class.php(336): E(':\n [ SQL\xE8\xAF\xAD\xE5\x8F\xA5 ...')
#1 /Library/WebServer/Documents/jfpt/ThinkPHP/Library/Think/Db/Driver.class.php(217): Think\Db\Driver->error()
#2 /Library/WebServer/Documents/jfpt/ThinkPHP/Library/Think/Model.class.php(1376): Think\Db\Driver->execute('load data local...')
#3 /Library/WebServer/Documents/jfpt/Payment/Bank/Controller/NetworkController.class.php(135): Think\Model->execute('load data local...')
#4 [internal function]: Bank\Controller\NetworkController->test()
#5 /Library/WebServer/Documents/jfpt/ThinkPHP/Library/Think/App.class.php(164): ReflectionMethod->invoke(object(Bank\Controller\NetworkController))
#6 /Library/WebServer/Documents/jfpt/ThinkPHP/Library/Think/App.class.php(202): Think\App::exec()
#7 /Library/WebServer/Documents/jfpt/ThinkPHP/Library/Think/Think.class.php(120): Think\App::run()
#8 /Library/WebServer/Documents/jfpt/ThinkPHP/ThinkPHP.php(97): Think\Think::start()
#9 /Library/WebServer/Documents/jfpt/index.php(24): require('/Library/WebSer...')
#10 {main}

ThinkPHP3.2.3 { Fast & Simple OOP PHP framework } -- [ WE CAN DO IT JUST THINK ]
最佳答案
评论( 相关
后面还有条评论,点击查看>>