PHP System Command function usage analysis. Copy the code as follows: functionexecute ($ cmd) {$ res; if ($ cmd) {if (function_exists (system) {@ ob_start (); @ system ($ cmd ); $ res @ ob_get_contents (); @ ob_end_clean ();}
The code is as follows:
Function execute ($ cmd ){
$ Res = '';
If ($ cmd ){
If (function_exists ('system ')){
@ Ob_start ();
@ System ($ cmd );
$ Res = @ ob_get_contents ();
@ Ob_end_clean ();
} Elseif (function_exists ('passthru ')){
@ Ob_start ();
@ Passthru ($ cmd );
$ Res = @ ob_get_contents ();
@ Ob_end_clean ();
} Elseif (function_exists ('shell _ exec ')){
$ Res = @ shell_exec ($ cmd );
} Elseif (function_exists ('exec ')){
@ Exec ($ cmd, $ res );
$ Res = join ("\ n", $ res );
} Elseif (@ is_resource ($ f = @ popen ($ cmd, "r "))){
$ Res = '';
While (! @ Feof ($ f )){
$ Res. = @ fread ($ f, 1024 );
}
@ Pclose ($ f );
}
}
Return $ res;
}
The http://www.bkjia.com/PHPjc/328006.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/328006.htmlTechArticle code is as follows: function execute ($ cmd) {$ res = ''; if ($ cmd) {if (function_exists ('system') {@ ob_start (); @ system ($ cmd); $ res = @ ob_get_contents (); @ ob_end_clean ();}...