escapeshellcmd

(PHP 4, PHP 5, PHP 7)

escapeshellcmdshell 元锟街凤拷转锟斤拷

说锟斤拷

escapeshellcmd ( string $command ) : string

escapeshellcmd() 锟斤拷锟街凤拷锟斤拷锟叫匡拷锟杰伙拷锟斤拷骗 shell 锟斤拷锟斤拷执锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷址锟斤拷锟斤拷锟阶拷濉� 锟剿猴拷锟斤拷锟斤拷证锟矫伙拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷诖锟斤拷偷锟� exec() 锟斤拷 system() 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 执锟叫诧拷锟斤拷锟斤拷 之前锟斤拷锟斤拷转锟藉。

锟斤拷斜锟竭o拷\锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街凤拷之前锟斤拷锟诫: &#;`|*?~<>^()[]{}$\, \x0A 锟斤拷 \xFF锟斤拷 ' 锟斤拷 " 锟斤拷锟节诧拷锟斤拷远锟斤拷锟绞憋拷锟阶拷濉� 锟斤拷 Windows 平台锟较o拷锟斤拷锟斤拷锟斤拷些锟街凤拷锟皆硷拷 % 锟斤拷 ! 锟街凤拷锟斤拷锟结被锟秸革拷锟斤拷妗�

锟斤拷锟斤拷

command

要转锟斤拷锟斤拷锟斤拷睢�

锟斤拷锟斤拷值

转锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷

锟斤拷锟斤拷

Example #1 escapeshellcmd() example

<?php
// 锟斤拷锟角癸拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥诧拷锟斤拷
$command './configure '.$_POST['configure_options'];

$escaped_command escapeshellcmd($command);
 
system($escaped_command);
?>

Warning

escapeshellcmd() 应锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街凤拷锟斤拷锟较★拷 锟斤拷使锟斤拷耍锟斤拷锟斤拷锟斤拷呋锟斤拷强锟斤拷源锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷牟锟斤拷锟斤拷锟� 锟斤拷使锟斤拷 escapeshellarg() 锟斤拷锟斤拷 锟皆碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷转锟藉。

锟斤拷锟斤拷锟斤拷志

锟芥本 说锟斤拷
5.4.43, 5.5.27, 5.6.11 锟斤拷叹锟脚会被锟秸革拷锟斤拷锟芥换锟斤拷

锟轿硷拷

  • escapeshellarg() - 锟斤拷锟街凤拷锟斤拷转锟斤拷为锟斤拷锟斤拷锟斤拷 shell 锟斤拷锟斤拷锟斤拷使锟矫的诧拷锟斤拷
  • exec() - 执锟斤拷一锟斤拷锟解部锟斤拷锟斤拷
  • popen() - 锟津开斤拷锟斤拷锟侥硷拷指锟斤拷
  • system() - 执锟斤拷锟解部锟斤拷锟津,诧拷锟斤拷锟斤拷示锟斤拷锟�
  • 执锟斤拷锟斤拷锟斤拷锟�