- <?php
- /*
- 파일 11.php와
- 파일 22.php가 있다는 가정입니다.
- */
- // system()함수;
- echo "system()함수<br>\n";
- if(system("ls",$line)){
- // ls는 리눅스에서 파일 리스트 출력 명령어 입니다.
- echo "<br>\n".$line."<br>\n";
- }
- else{
- echo "system()함수 실패<br>\n";
- }
- /* 출력 내용
- system()함수
- 11.php 22.php
- 0
- */
- ?>
--------------------------------------------------------------------------------------------
string system ( string $command [, int &$return_var ] )
9. 라인
$command에 리눅스 명령어를 넣으면
로컬 시스템에서 실행이 되면, 실행결과가 출력됩니다.
$var 값은 실행에 대한 값이 반환됩니다.
비슷한 함수로는 exec()함수와 shell_exec()가 있습니다.
'php5 > 파일관련함수' 카테고리의 다른 글
파일 복사 - bool copy ( string $source , string $dest ) (0) | 2014.01.10 |
---|---|
시스템 명령어 실행2 - string exec ( string $command ) (0) | 2014.01.10 |
파일 경로 반환 - string dirname ( string $path ) (0) | 2014.01.09 |
파일의 현재 작업 디렉토리 반환 - string getcwd ( void ) (0) | 2014.01.09 |
파일 경로에서 파일명만 반환 - string basename ( string $path ) (0) | 2014.01.08 |