要是文本文本档\r\n应该是可以的。如果是html文件,应该是<br>

解决方案 »

  1.   

    if($gDB->query_is_success()){

    do{
    //$result[$i]=;
    //$gDB->Record['team_name_cn']
    $str_temp='array[0]=new Array("'.$i.'","root","'.$gDB->Record['team_name_cn'].'");\\r\\n';
    $upper_str.=($str_temp);

    $member_names=split(",",$gDB->Record['member_names']);
    //var_dump($member_names);
    $max=count($member_names);

    for($j=0;$j<$max;$j++){
    $str_temp='array[3]=new Array("","'.$i.'","'.$member_names[$i].'");\\r\\n';
    $lower_str.=($str_temp);
    }

    $i++;
    }while($gDB->next_record());

    //var_dump($upper_str);
    //var_dump($lower_str);

    $str_body=$upper_str.$lower_str;

    $file_str=$str_head."\n\n".$str_body."\n\n".$str_foot; if (!$handle = fopen("../../datacenter/js/init_interact_select_box.jss", 'w')) {
            echo "读入文件有误!$filename";
            exit;
        }
    //$handle = fopen("/datacenter/js/init_interact_select_box.jss", "w+");

    if (fwrite($handle, $file_str) === FALSE) {
           echo "写入文件有误!!";
           exit;
        }
    echo "写入成功!!".'<br>';
    }
    else{
    echo "添加失败!!".'<br>';
         exit();
    }
    大致的代码
    但写入的文件里只有硬编码的\r\narray[0]=new Array("8","root","利物浦");\r\narray[0]=new Array("9","root","曼城");\r\narray[0]=new Array("10","root","曼联");\r\narray[0]=new Array("11","root","米德尔斯堡");\r\narray[0]=new Array("12","root","纽卡斯尔");\r\narray[0]=new Array("13","root","朴斯茅斯");\r\narray[0]=new Array("14","root","切尔西");\r\narray[0]=new Array("15","root","桑德兰");
      

  2.   

    运行后请用浏览器打开,再查看源代码echo "11111111\n\111111111\n\111111111<br>";
    echo "\n\r222222222\n\r<br>22222222222\n\r<br>22222222";
      

  3.   

    <br/ >   I think
      

  4.   

    不是浏览器下显示换行<br><br />没有用的!
      

  5.   

    问题是你用PHP向什么文件写入换行符号
    不同类型的文件的换行符号不一样~~~
    比如excel文件就是\t
    txt就是\r\n
    html就是<br>
    等等`~
      

  6.   

    在str里打了个回车居然解决了!
    $str="aaa
    ";哎
      

  7.   

    你想换行,就用双引里面的\r\n,注意不要被程序addslashes了。保证无措。
      

  8.   

    $str_temp='array[3]=new Array("","'.$i.'","'.$member_names[$i].'");\\r\\n';
    这段应该是
    $str_temp='array[3]=new Array("","'.$i.'","'.$member_names[$i].'");\r\n';
      

  9.   

    请注意 '\r\n'中的\r\n是不会被作为换行的。
      

  10.   

    fwrite($fp,"<?PHP exit('Access Denied'); ?>\n")
    可以换行的,不过你要用UE打开,用记事本打开不会自动换行。