Zwraca wyjście Perla do PHP
Chcę zwrócić dane wyjściowe skryptu perla na stronie internetowej. Zwraca jednak tylko ostatnią linię.
Skrypt Perla:
my $directory = $ARGV[0];
opendir(DIR,$directory);
my @files = grep {/\.txt$/ } readdir(DIR);
closedir(DIR);
foreach(@files) {
print $_."\n";
}
Kod PHP:
$perl_result = exec("perl $script_folder $project_folder");
*some code*
<?php print $perl_result; ?>
Oczekiwane dane wyjściowe (i to, co skrypt zwraca w wierszu poleceń systemu Linux):
test.txt
test2.txt
test3.txt
Co zwraca PHP:
test3.txt
Co muszę zmienić w kodzie, aby PHP wyświetlał wszystkie wiersze?
Dzięki