研究開発、テスト、運用環境が異なるため、フィードバックの問題により環境を正しく特定できないことがよくあります。現在の環境は WEB インターフェイスの目立つ位置に表示できます。
public static function getGitinfo()
{
if (App: :environment() == "product") {
$host = 'Production';
} // ブランチ名を取得します
$ Branch = @file_get_contents (base_path ().' /.Git/head'; ) ;
if (! Empty ($ Branch)) {
$ Branch = Trim ($ Branch )
}
//本番環境でない場合にのみ表示されます
@if (!App::environment()==' Production' )
<script><br>var content = '{{ getGitinfo() }} ' ';<br>var div = document.createElement("div");<br>div.style = "font-size:24px; Position:絶対;背景:#ee6666;パディング左:20px;";<br>div.innerHTML = content;<p>var first= document .body.firstChild;</p>document.body.insertBefore(div,first);<p></script> @endif
上記は、PHP を使用して現在の GIT ブランチのコードを取得する方法を、関連する内容も含めて紹介しました。PHP チュートリアルに興味のある友人に役立つことを願っています。