doujie7346 2016-08-05 11:51
浏览 31
已采纳

Php - 来自Text文件的echo line 6

How to echo line 6 from Text file?

I have tried this. But i dont know what to do further. This is not working. What to change?

   <?
   $file1 = "file/datum2.html";
   $lines = file($file1);
   foreach($lines as $line_num => $line)
    {
    echo $line[6];
    echo "<br>";
   }

  ?>

Datum2.html:

1-juli-2016 2-juli-2016 3-juli-2016 4-juli-2016 5-juli-2016 6-juli-2016

This is the result now with help

enter image description here

  • 写回答

4条回答 默认 最新

  • doujiacai4986 2016-08-05 12:17
    关注
    echo implode('<br />', array_slice(file('file/datum2.html'), 0, 6));
    

    OR

    echo implode('
    ', array_slice(file('file/datum2.html'), 0, 6));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 滑块验证码拖动问题悬赏
  • ¥15 Wanted but not invoked:Actually, there were zero interactions with this moc
  • ¥20 怎么驱动tb6612
  • ¥15 Arcgis 3D效果点要素
  • ¥15 在执行yolo训练脚本的时候,没有报错,在扫描val这一步后就推出执行了
  • ¥15 delphi开发的WEBSERVER改用HTTPS协议
  • ¥15 pic16f877A单片机的计数器proteus仿真失效
  • ¥100 调查 Vitis AI 中验证 .xmodel 量化后的正确性
  • ¥30 codelite全屏时file、setting那一行消失了
  • ¥15 gazebo-rviz教程