有办法能够将他们链接起来吗? 本帖最后由 everydayrun1 于 2011-08-04 16:43:52 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 两个文件的行数一样么?且一一对应?<?php $content1=file_get_content("A.txt"); $array1=explode('\n',$content1); $content2=file_get_content("B.txt"); $array2=explode('\n',$content2); for($i=0;$i<count($array1);$i++) $contentNew.=$array2[$i].$array1[$i]."\n"; file_put_contents("aa.txt",$contentNew);?> 忘了在循环之前加上初始化语句 $contentNew=''; 假定两文件行数一致,并无空行function foo($a, $b) { return trim($a) . trim($b) . ';';}$a = file('文件A');$b = file('文件B');$c = array_map('foo', $b, $a);echo join(PHP_EOL, $c); $a = @file_get_contents('a.txt');$a = explode("\r\n",trim($a));$b = @file_get_contents('b.txt');$b = explode("\r\n",trim($b));$combination = array();foreach((array)$a as $key=>$value){ $combination[] = $b[$key].$value.';';}implode("\r\n",$combination);@file_put_contents('c.txt',$combination);还是版主的简洁 wamp 环境下 vs.php 调试 问题 请教 JS弹出窗口的问题,大家帮我看看,应该很简单吧,就是我菜 请问require和include包含的文件过多,会影响到运行速度吗? GB码到UTF码,但服务器不支持iconv()怎么办? 高分求php生成机器码的问题? 用PHP生成條形碼,要怎麼配置php.ini,並告知以下錯誤是怎麼回事,謝謝! 40分求 一个已经验证过可以发送邮件的代码! 这个正则表达式怎么写? 有没有把php转换为jsp的工具? 关于在 Win2000 Server IIS 下安装 PHP的问题。 求教phpmailer发邮件问题 兄弟们,这样为什么不行?
$content1=file_get_content("A.txt");
$array1=explode('\n',$content1);
$content2=file_get_content("B.txt");
$array2=explode('\n',$content2);
for($i=0;$i<count($array1);$i++)
$contentNew.=$array2[$i].$array1[$i]."\n";
file_put_contents("aa.txt",$contentNew);
?>
$contentNew='';
return trim($a) . trim($b) . ';';
}$a = file('文件A');
$b = file('文件B');$c = array_map('foo', $b, $a);echo join(PHP_EOL, $c);
$a = @file_get_contents('a.txt');
$a = explode("\r\n",trim($a));
$b = @file_get_contents('b.txt');
$b = explode("\r\n",trim($b));
$combination = array();
foreach((array)$a as $key=>$value){
$combination[] = $b[$key].$value.';';
}
implode("\r\n",$combination);
@file_put_contents('c.txt',$combination);还是版主的简洁