更新时间:2023-02-22 11:50:38
如果您的命令如下:
exec("pstill -F a4 -2 -c -c -c -c -g -i -t -K -d 700 -a 4 -m XimgAsCMYK -m Xspot -m Xoverprint -o D:\\outputfile.pdf D:\\input.jpg");
PHP转义反斜杠,因此到达shell的命令是 .. 。D:\outputfile.pdf D:\input.jpg
。您必须双重转义反斜杠:一次用于PHP,一次用于shell。
PHP escapes the backslashes, so the command that reaches the shell is ... D:\outputfile.pdf D:\input.jpg
. You have to double-escape the backslashes: once for PHP and once for the shell.
exec("pstill -F a4 -2 -c -c -c -c -g -i -t -K -d 700 -a 4 -m XimgAsCMYK -m Xspot -m Xoverprint -o D:\\\\outputfile.pdf D:\\\\input.jpg");