Ver Mensaje Individual
  #3  
Antiguo 25-03-2018
jhonalone jhonalone is offline
Miembro
 
Registrado: sep 2007
Ubicación: Madrid
Posts: 571
Reputación: 20
jhonalone Va por buen camino
Gracias, yusneerqui.

Creo que no me expliqué bien. La función pertenece a JS. Y ya he utilizado otras veces algo semejante. La función completa es así.

Código PHP:
<script>
function HazArrayM_txt()
{
var l;
datosM = []; // Vaciamos el array

<?php        
if (file_exists('XX/Prueba.txt'))
{
    
$fp = fopen('XX/Prueba.txt', 'r');
    while (!
feof($fp))
    {
        
$linea = fgets($fp);
        
$l = strlen($linea);
        if (
$l > 17) 
        
$linea = substr($linea, 0, 16);
        {
        
?>
    l = <?php echo $linea;?>
        //datosM.push(l);
    alert(l);
        <?php
        
}
    }
    
fclose($fp);
}
// if    
    
?>        
}; // fin HazArrayM
</script>
Saludos.
__________________
"Pedid y se os dará; buscad y hallaréis ..." (Lc 11,9-10)
"...si no tengo caridad, nada soy..." (1 Cor 13,1-13)
Responder Con Cita