2678777127 发表于 2018-2-11 12:08:43


            本文分析了php使用escapeshellarg时中文被过滤的解决方法。分享给大家供大家参考。具体如下:
一、问题:
同样的代码,发现通过 localhost/index.php 访问,和在 shell 中通过 php ./index.php 运行結果却不一样。
在程序中需要通过 shell_exec 来执行一个 linux 程序,而它的输入来自 echo ,即:
shell_exec('echo '.escapeshellarg($str).' | some_cmd 2>&1');
页: [1]
查看完整版本: php使用escapeshellarg时中文被过滤的解决方法