Home > Article > Backend Development > PHP code to run SVN command to display file update records of a certain user_PHP tutorial
$cmd='/usr/bin/svn log -v -r {'.$d.'}:"HEAD" --username username--password password--no-auth-cache | sed -n "/'.$user.'/,/-----$/ p" 2>&1';
$p=dirname(__FILE__);
exec('cd '.$p,$output);
exec($cmd,$output);
$d=date('Y year m month d day',strtotime($d));
echo $user.'Since '.$d.':
';
echo '---------------------------------------------
$out='';
krsort($output);
if(!empty($output)){
foreach($output as $v){
$p1=strpos($v,'/branch/');
$p2=strpos ($v,'/tg/');
if($p1!==false || $p2!==false){
if($p1!==false){
$v =substr($v,$p1+9);
}else{
$v=substr($v,$p2+4);
}
if($out=='' ){
$out=$v;
echo $v.'
';
}else{
if(strpos($out,$v)===false){
$out.=','.$v;
echo $v.'
';
}
}
}
}
}else{
echo "No file";
}
?>