system - 명령어 함수

system
(PHP 3, PHP 4 , PHP 5)

system -- Execute an external program and display the output
Description
string system ( string command [, int return_var])


system() is just like the C version of the function in that it executes the given command and outputs the result. If a variable is provided as the second argument, then the return status code of the executed command will be written to this variable.


주의
사용자가 입력한 데이터를 이 함수로 넘길 때는, escapeshellarg()나 escapeshellcmd()를 사용하여, 사용자가 어떠한 명령을 실행하여 시스템을 조작하지 못하게 하여야 합니다.


참고: 이 함수를 사용하여 프로그램을 실행하고, 백그라운드에서 작업하게 내버려두려면, 그 프로그램의 출력이 파일이나 다른 출력 스트림을 향하게 하여야 합니다. 그렇지 않으면 PHP는 그 프로그램이 종료할 때까지 정지합니다.

The system() call also tries to automatically flush the web server's output buffer after each line of output if PHP is running as a server module.

Returns the last line of the command output on success, and FALSE on failure.

If you need to execute a command and have all the data from the command passed directly back without any interference, use the passthru() function.

예 1. system() example

< ?php
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', $retval);

// Printing additional info
echo '


Last line of the output: ' . $last_line . '

Return value: ' . $retval;
? >



참고: 안전 모드에서 실행 명령은 safe_mode_exec_dir 안에서만 실행할 수 있습니다. 실용적인 이유로, 실행 경로에 ..을 허용하지 않습니다.


주의
안전 모드에서는 처음 명령어 이후에 따라오는 모든 단어를 하나의 인수로 취급합니다. 그러므로, echo y | echo x은 echo "y | echo x"가 됩니다.


See also exec(), passthru(), popen(), escapeshellcmd(), pcntl_exec(), and the backtick operator.
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2006/12/11 15:29 2006/12/11 15:29
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2147

Trackback URL : http://tcbs17.cafe24.com/tc/trackback/2147

« Previous : 1 : ... 4260 : 4261 : 4262 : 4263 : 4264 : 4265 : 4266 : 4267 : 4268 : ... 6391 : Next »

블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/05   »
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Statistics Graph

Site Stats

Total hits:
186383
Today:
641
Yesterday:
745