programming/php

PHP backticks shell command

applicationlayer 2010. 8. 4. 18:57
http://gooja.tistory.com/55

PHP 에서 exec() 함수와 같은 기능을하는 backtiks 이 있다.
``Note that these are not single-quotes!
backtick(``) 를 이용해서 shell 명령어를 실행할 할 수 있다.

<예>
<?php
$output = `ls -al`;
echo "<pre>$output</pre>";
?>

<pre></pre>는 실행결과를 자동으로 줄바꿈을 해서 보기 편리하다.