先在mysql配置文件my.ini的[mysqld]
添加
local-infile=1
secure_file_priv=""
分别在php.ini和php-cli.ini中查找
mysqli.allow_local_infile
前面的注释去掉
php中连接数据库部分
$conn = new mysqli();
mysqli_options($conn, MYSQLI_OPT_LOCAL_INFILE, true);
$conn->connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);