Ver Mensaje Individual
  #5 (permalink)  
Antiguo 05/03/2012, 18:47
Avatar de carlos_belisario
carlos_belisario
Colaborador
 
Fecha de Ingreso: abril-2010
Ubicación: Venezuela Maracay Aragua
Mensajes: 3.156
Antigüedad: 14 años
Puntos: 461
Respuesta: Leer registros de un txt separados con una barra

te podría servir esta mini-librería para gestionar txt que he estado creando hace unas semana, es para leer archivos txt o csv mayormente, podrías hacer algo como esto
archivo.php
Código PHP:
Ver original
  1. <?php
  2. require_once 'FileManager.php';
  3. $file = new FileManager\Libs\File('archivo.txt');
  4. $content = $file->getContent();
  5. foreach($content as $line => $lineContent) {
  6.     $explodeFileLine[] = explode('|', $lineContent);
  7. }?>
  8. <table>
  9. <?php
  10. foreach($explodeFileLine as $k =>$v) {?>
  11.    <tr>
  12.        <td><?php echo $k + 1;?></td>       
  13.        <td><?php echo $v[0];?></td>
  14.        <td><?php echo $v[1];?></td>
  15.        <td><?php echo $v[2];?></td>
  16.        <td><?php echo $v[3];?></td>
  17.    </tr>
  18. <?php }?>
  19. </table>
espero te sea de ayuda, saludos
__________________
aprende d tus errores e incrementa tu conocimientos
it's not a bug, it's an undocumented feature By @David
php the right way