escapeshellcmd shell 元字符转义 &reftitle.description; stringescapeshellcmd stringcommand escapeshellcmd 对字符串中可能会欺骗 shell 命令执行任意命令的字符进行转义。 此函数保证用户输入的数据在传送到 execsystem 函数,或者 执行操作符 之前进行转义。 反斜线(\)会在以下字符之前插入:&#;`|*?~<>^()[]{}$\\x0A\xFF'" 仅在不配对儿的时候被转义。在 Windows 平台上,所有这些字符以及 %! 字符前面都有一个插入符号(^)。 &reftitle.parameters; command 要转义的命令。 &reftitle.returnvalues; 转义后的字符串。 &reftitle.examples; <function>escapeshellcmd</function> example ]]> &reftitle.notes; escapeshellcmd 应被用在完整的命令字符串上。 即使如此,攻击者还是可以传入任意数量的参数。 请使用 escapeshellarg 函数 对单个参数进行转义。 escapeshellcmd 不会对空格转义,这在 Windows 上对这样的路径(比如C:\Program Files\ProgramName\program.exe)可能会有出现问题。可以使用如下代码暂时解决: &reftitle.seealso; escapeshellarg exec popen system 执行运算符