Home > Backend Development > PHP Tutorial > PHP gets the code of the current GIT branch

PHP gets the code of the current GIT branch

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-28 08:25:45
Original
2632 people have browsed it

Due to different R&D, testing, and production environments, feedback problems often cannot correctly locate the environment. The current environment can be displayed in a prominent position on the WEB interface

public static function getGitinfo()

{
if (App::environment() == "product") {
              $host = 'Production'; The machine ';
}; // Get the branch name
$ Branch = @file_get_Contents (Base_path ().' /.Git/head') ;
If (! EMPty ($ Branch)) {
$ Branch = Trim ($ Branch );
}

//Only displayed when not in production

@if (!App::environment()=='production' )
<script><br>var content = '{{ getGitinfo() }} ' ';<br>var div = document.createElement("div");<br>div.style = "font-size:24px; position: absolute;background:#ee6666;padding-left:20px;";<br>div.innerHTML = content;<p>var first= document .body.firstChild;</p>document.body.insertBefore(div,first);<p></script>

@endif



The above introduces how to get the code of the current GIT branch with PHP, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.


Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template