Php Shell_exec输出文件失败


Php Shell_exec failing to output a file

大家好我要做的是

shell_exec("command"); #this works
shell_exec("ls > outfile");  #the directing to file does not work` 

[我自己的命令代替ls]: ls > outfile

所以我试着先用ls运行它,看看它是否有效,但它没有。它可以在命令行上运行,但php不能,即在浏览器中屏幕变成空白。

试试这个:

shell_exec("powershell.exe -command "& { ls > outfile }");