¿ù°£ Àα⠰Խù°

°Ô½Ã¹° 30°Ç
   
php ½©¸í·É¾î (shell_exec)
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2011-03-02 (¼ö) 12:51 Á¶È¸ : 26891
±ÛÁÖ¼Ò :
                          

shell_exec ÇÔ¼ö¸¦ ÀÌ¿ëÇϸé PHP»ó¿¡¼­ ½©¸í·É¾î¿¡ ´ëÇÑ °á°ú°ªÀ» À¥»ó¿¡ Ãâ·ÂÇÒ¼ö ÀÖ´Ù.
¾ÈÀü¸ðµå»ó¿¡¼­´Â ½ÇÇàµÇÁö ¾ÊÀ¸´Ï php.ini ÆÄÀÏÀ» È®ÀÎ
 safe_mode = Off
mojily_test.php
 
<?php
$data1 = shell_exec("ls -l /home/");
echo "<pre> $data1 </pre>";
$data = shell_exec("df -Th");
echo "<pre> $data </pre>"
?>
 
 
À¥¿¡¼­ÀÇ Ãâ·Â°á°ú

±×·¸´Ù¸é À¥¿¡¼­ ¸í·É¾î¸¦ Á÷Á¢Àû¾î Àü¼ÛÇÏ´Â °úÁ¤À» º¸¸é...
test.html
<html>
<form action="mojily_test.php" method="get">
INPUT CMD : <input type="text" name="value1">
<input type="submit" value="Àü¼Û">
</form>
</html>
 

 
mojily_test.php
<?php
$data = shell_exec("$value1");
echo "<pre> $data </pre>";
 
 
¾Æ·¡¿Í °°Àº â¿¡ ¸í·É¾î¸¦ Àû¾îÁÖ¸é µ¿ÀÏÇÑ °á°ú°¡ Ãâ·ÂµÈ´Ù.


shell_exec

(PHP 4 , PHP 5)
shell_exec --  Execute command via shell and return the complete output as a string

Description

string shell_exec ( string cmd)

This function is identical to the backtick operator.
Âü°í: ÀÌ ÇÔ¼ö´Â ¾ÈÀü ¸ðµå¿¡¼­ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.

À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.