<?php
$ha = fopen("a.txt","r");
$hb = fopen("b.txt","w");
while ($nn = fscanf($ha, "%d.%d.%d.%d")) {
    list ($n1, $n2, $n3, $n4) = $nn;
fprintf($hb,"%d.%d.%d.%d\r\n",$n1*10,$n2*10,$n4*10,$n4*10);
}
fclose($ha);
fclose($hb);
?> 

解决方案 »

  1.   


    <?php 
    $content = file_get_contents('C:\Inetpub\wwwroot\a.txt');
    $arr = explode("\r\n", $content);
    $s = "";
    for($i=0;$i<count($arr);$i++){
    $items = explode(".", $arr[$i]);
    for($j=0;$j<count($items);$j++){
    $s .= $items[$j]*10;
    if($j != count($items)-1) $s .= '.';
    }
    $s .= "\r\n";
    }
    file_put_contents('C:\Inetpub\wwwroot\b.txt',$s);
    ?>