$file_var=file(sys.ini);//取得一个数组,保存在$file_var里,每行为一个数组单元
echo $file[3];

解决方案 »

  1.   

    $file_var=file("sys.ini");//取得一个数组,保存在$file_var里,每行为一个数组单元
    echo $file[3];
    应该还有双引号,忘记加了~
      

  2.   

    噢,我没说清楚,文件里有好多行啊,我需要对下面的一段进行操作的,就是怎么定位的问题
    [driver32]
    Driver=C:\WINNT\System32\SQLSRV32.dll
    Setup=C:\WINNT\System32\sqlsrv32.dll
      

  3.   

    判断条件是:=="[driver32]\n"
    然后用while组合循环试试看
      

  4.   

    <?php
    $str="[mci]
    32Bit=1
    16Bit=2
    [driver32]
    Driver=C:\WINNT\System32\SQLSRV32.dll
    Setup=C:\WINNT\System32\sqlsrv32.dll
    [386enh]
    woafont=app936.FON
    EGA80WOA.FON=EGA80WOA.FON
    CGA40WOA.FON=CGA40WOA.FON";
    preg_match("'\[driver32\](.+)\['sm",$str,$m);
    echo nl2br($m[1]);
      

  5.   

    这是完整的
    <?php
    $file="sys.ini";//文件路径
    $str=fread(fopen($file,"r"),filesize($file));
    preg_match("'\[driver32\](.+)\['sm",$str,$m);
    echo nl2br($m[1]);
    ?>