当我尝试将每一行插入我的oracle数据库时,我得到一个错误,指出无效的数字,但如果文件中只有一行,它工作正常.
$file = @fopen('file.text', "r") ;
// while there is another line to read in the file
while (!feof($file))
{
// Get the current line that the file is reading
$currentLine = fgets($file) ;
$currentLine = explode(' ',$currentLine) ;
insert($currentLine) ;
}
fclose($file) ;
Run Code Online (Sandbox Code Playgroud)
线条看起来像这样
1 4 100
1 4 101
Run Code Online (Sandbox Code Playgroud)
试试这个:
$currentLine = trim(fgets($file));
Run Code Online (Sandbox Code Playgroud)
它可能在线路末端的换行/回车失败.
如果没有,这个insert()函数在哪里定义?构建一个调试部分,回显或写出尝试的查询,以便您真正看到问题.
| 归档时间: |
|
| 查看次数: |
27493 次 |
| 最近记录: |