我希望有像escapeshellarg这样的东西,允许通配符/全局匹配,来做这样的事情:
$arg = escapeshellarg('fol der/*.ext');
echo `ls $arg -t | head -1`但是,当然,引用ls的论点会禁用全局匹配。
我猜想有一些addslashes和它的近亲的组合来获得一个很好地转义的、非引用的参数(在本例中是:fol\ der/*.ext)?
我知道glob()但是我喜欢ls -t..。
欢迎使用shell_exec("ls * -t | head -1")的不错和简短的替代方案,如果不是我所要求的…
发布于 2015-03-17 08:04:50
$arg = escapeshellarg('fol der').'/*.ext';https://stackoverflow.com/questions/18025042
复制相似问题