PHP library for creating/manipulating fixed-width text files

前端 未结 7 1267
走了就别回头了
走了就别回头了 2021-02-05 09:27

We have a web application that does time-tracking, payroll, and HR. As a result, we have to write a lot of fixed-width data files for export into other systems (state tax filing

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-05 09:40

    If this is text file with separated fields, - your will need write it yourself. Probably it is not a large problem. Good organization, will save a lot of time.

    1. Your need universal way of defining structures. I.e. xml.
    2. Your need something to generate ... specially I prefer an Smarty templating for this.

    So this one:

       
    
          123
    
          123
    
          123
    
        
    

    Can be easy interpreted into test with this template:

    {section name=x1 loop=level1_arr}
    
    {--output root's--}
    
      {section name=x2 loop=level1_arr[x1].level2_arr}
    
         {--output entry's--}
    
      {/section}
    
    {/section}
    

    This is just idea.

    But imagine:

    1. You need xml
    2. You need template

    i.e. 2 definitions to abstract any text structure

提交回复
热议问题