<?php
$cmd = '/home/xiaoyan/svn.sh2>&1';
$str = exec($cmd, $out, $re);
echo '<pre>';
print_r(array('cmd' => $cmd, 'exec_return' => $str, 'exec_out' => $out, 'exe_re' => $re));
echo '</pre>';
----进行错误输出重定向[ 2>&1]的输出,如果不重定向,无权提示是无法捕获的----
Array( [cmd] => /home/xiaoyan/svn.sh 2>&1 [exec_return] => svn: Can't open file '/var/www/phpcms/statics/images/chrd/.svn/lock': Permission denied [exec_out] => Array ( [0] => svn: Can't open file '/var/www/phpcms/statics/images/chrd/.svn/lock': Permission denied ) [exe_re] => 1)