From http://ie2.php.net/manual/en/function.escapeshellarg.php
escapeshellarg() adds single quotes
around a string and quotes/escapes any
existing single quotes allowing you to
pass a string directly to a shell
function and having it be treated as a
single safe argument.
escapeshellarg, as its name indicates, is used as passing shell argument(s). For example, you want to list current directory,
$dir = ".";
system('ls '.escapeshellarg($dir));
escapeshellcmd('ls $dir');
Both do similar things and simply depends on how you handle your logic, do make sure your normalize and validate your input before passing directly to these methods for better security.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…