PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Variablen im Befehl "system" ?



Stormsam
20-12-2003, 21:56
HI @all,

kann mir einer sagen wieso das nicht funktioniert:

<?php

$ordner = "user";
echo '<pre>';

// Outputs all the result of shellcommand "ls", and returns
// the last output line into $last_line. Stores the return value
// of the shell command in $retval.
$last_line = system('ls -la \'/srv/www/test2/$ordner\' ',

$retval);

// Printing additional info
echo '
</pre>
<hr>Last line of the output: '.$last_line.'
<hr>Return value: '.$retval;

?>
<?php echo $ordner; ?>

Den Code habe ich von php.net (Ohne Variable !).
Beim echo ganz unten zeigt er auch "user" an, doch er geht nicht in das Verzeichnis "/srv/www/test2/user", weiß einer wieso ?

MfG
Stormsam

offe
21-12-2003, 09:01
$last_line = system('ls -la '/srv/www/test2/$ordner' ',$retval);
als

$last_line = system("ls -la \"/srv/www/test2/$ordner\" ",$retval);

Offe