Mailinglisten-Archive |
hi mike,
"Mike Rübsamen" wrote:
> ich möchte gerne die Augabe eines Linux-Commandos mit
> PHP auslesen. Ich verwende dazu die Funktion:
>
> $foo=exec("ls");
> echo $foo;
>
> Das liefert mir aber leider immer nur die letzte Ausgabezeile
> zurück. Auch das Erzwingen eines Array mittel:
>
> $foo=array(exec("ls"));
>
> liefert nur ein Arrayelement zurück. Weiß jemand, wie ich über
> einen Array alle Ausgabezeilen zurückbekomme?
exec("ls",$st);
while(list($k,$v)=each($st)) {
echo $v."<br>";
}
http://www.php.net/manual/function.exec.php3
manual> string exec(string command, string [array], int [return_var]);
manual> If the array argument is present, then the specified array
manual> will be filled with every line of output from the command.
gruss
alex
--
*****************************************
*** Alex Killing *** http://4real.de/ ***
*****************************************
php::bar PHP Wiki - Listenarchive