(PHP 4, PHP 5, PHP 7)
escapeshellcmd — shell 元锟街凤拷转锟斤拷
$command
) : stringescapeshellcmd() 锟斤拷锟街凤拷锟斤拷锟叫匡拷锟杰伙拷锟斤拷骗 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);
?>
escapeshellcmd() 应锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街凤拷锟斤拷锟较★拷 锟斤拷使锟斤拷耍锟斤拷锟斤拷锟斤拷呋锟斤拷强锟斤拷源锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷牟锟斤拷锟斤拷锟� 锟斤拷使锟斤拷 escapeshellarg() 锟斤拷锟斤拷 锟皆碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷转锟藉。
锟芥本 | 说锟斤拷 |
---|---|
5.4.43, 5.5.27, 5.6.11 | 锟斤拷叹锟脚会被锟秸革拷锟斤拷锟芥换锟斤拷 |