📅  最后修改于: 2022-03-11 14:53:42.595000             🧑  作者: Mango
function get_current_git_branch(){
$fname = sprintf( '.git/HEAD' );
$data = file_get_contents($fname);
$ar = explode( "/", $data );
$ar = array_reverse($ar);
return trim ("" . @$ar[0]) ;
}
function get_current_git_datetime( $branch='master' ) {
$fname = sprintf( '.git/refs/heads/%s', $branch );
$time = filemtime($fname);
if($time != 0 ){
return date("Y-m-d H:i:s", $time);
}else{
return "time=0";
}
}