douzhan8652 2011-05-30 12:18
浏览 230
已采纳

从文本文件PHP中提取一行

I Have a text file and want to parse it with PHP

any one has any idea how can I get IMPATTO LTD

IMPATTO LTD                               ZAHLUNG:       A

from the line above ?

I was thinking maybe regex but there is no uniform way of extracting it.. I guess the best is an expression that will get me the text until the Z from Zahlung.. Is this possible ?

By the way the first words can be of variable length...

  • 写回答

5条回答 默认 最新

  • dsdf64562672 2011-05-30 12:21
    关注
    $string = null;
    $itms = explode('ZAHLUNG', $line);
    if(is_array($itms) AND isset($itms[0])) {
        $string = trim($itms[0]);
    }
    
    echo $string; // IMPATTO LTD
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料