2011-10-17 3 views
1

이 간단한 스크립트가 제대로 작동하도록하는 방법이 있습니까?shell_exec() 스크립트의 변수

<?php 
$hi = "echo hi"; 
shell_exec($hi); 
echo "<pre>$output</pre>"; 
?> 

도와주세요.

+0

'shell_exec ($ hi);'$ output = shell_exec ($ hi);'를 읽지 말아야합니까? – DaveRandom

+0

thx, 나는 우연히 뭔가를 삭제해야합니다. –

답변

2

물론 변수를 할당하십시오.

<?php 
$hi = "echo hi"; 
$output = shell_exec($hi); 
echo "<pre>$output</pre>"; 
?> 
1
$hi = "echo hi"; 
# the result needs to be assigned to $output before using it 
$output = shell_exec($hi); 
echo "<pre>$output</pre>";