Web Programming Language/PHP
PHP) shell_exec() 함수
manchesterandthecity
2020. 11. 5. 18:52
shell_exec() 함수
쉘을 통해 명령을 실행하고 전체 출력을 문자열로 반환하는 함수.
함수 형태
shell_exec ( string $cmd ) : string |
이 함수는 backtick 연산자와 동일하다.
파라미터
cmd
실행될 명령
반환 값
오류가 발생하거나 프로그램이 출력을 생성하지 않을 때, NULL을 반환.
예시
Example #1 A shell_exec() example
<?php $output = shell_exec('ls -lart'); echo "<pre>$output</pre>"; ?> |
출처 :