我有这样的代码:PHP的fwrite功能新线
//This line is for the input that i've looped above my code, it's a URL
$textAr[$i] = str_replace("\r\n","", $textAr[$i]);
//This is for implode purposes
$finalArray = array($textAr[$i], $m1, $m2, $m3, $m4, $m5, $m6);
//When i echo this variable, $test, the URL is in the line along with the implode arrays
$test = implode($finalArray, "***");
echo $test."\n";
//This is for writing into my text file
fwrite($sitesTxt, implode($finalArray, "***")."\n");
我有那种错误的地方后,我输入3个网址,第一和第二URL都有新的生产线后,我在文件中写,但我输入的最后一个URL与内部阵列一致。我甚至修剪了$ textArr,但我不断收到新的内容。
预期输出:
https://docs.google.com***false***false***false***false***false***false***
https://stackoverflow.com***false***false***false***false***false***false***
https://stackexchange.com***false***false***false***false***false***false***
输出I在txt文件让我:
https://docs.google.com
***false***false***false***false***false***false***
https://stackoverflow.com
***false***false***false***false***false***false***
https://stackexchange.com***false***false***false***false***false***false***
发表您的完整代码,请(包括循环,例如数据) – vietnguyen09
你能告诉我什么是'$ textArr [$ i]'?你可以回应它吗?或者只是给出示例数据 –
我的代码是垃圾。这是为了noobs。无论如何,我已经接受RichGold的解决方案,它为我工作。谢谢! –