本文整理汇总了PHP中Git::getBranches方法的典型用法代码示例。如果您正苦于以下问题:PHP Git::getBranches方法的具体用法?PHP Git::getBranches怎么用?PHP Git::getBranches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Git
的用法示例。
在下文中一共展示了Git::getBranches方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
break;
case 'renameRemote':
if (isset($_GET['path']) && isset($_GET['name']) && isset($_GET['newName'])) {
$result = $git->renameRemote(getWorkspacePath($_GET['path']), $_GET['name'], $_GET['newName']);
if ($result === false) {
echo '{"status":"error","message":"Failed to rename remote!"}';
} else {
echo '{"status":"success","message":"Remote renamed!"}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'getBranches':
if (isset($_GET['path'])) {
$result = $git->getBranches(getWorkspacePath($_GET['path']));
if ($result === false) {
echo '{"status":"error","message":"Failed to get branches!"}';
} else {
echo '{"status":"success","data":' . json_encode($result) . '}';
}
} else {
echo '{"status":"error","message":"Missing parameter!"}';
}
break;
case 'newBranch':
if (isset($_GET['path']) && isset($_GET['name'])) {
$result = $git->newBranch(getWorkspacePath($_GET['path']), $_GET['name']);
if ($result === false) {
echo '{"status":"error","message":"Failed to create branch!"}';
} else {
示例2:
<title>Example - a fast and ugly Git view</title>
<script src="prettify.js" type="text/javascript"></script>
<link rel="stylesheet" href="prettify.css"
type="text/css" media="screen" />
</head>
<body>
<table>
<tr>
<th>Branches</th>
<th>Tags</th>
</tr>
<tr>
<td>
<ul>
<?php
foreach ($git->getBranches() as $branch) {
?>
<li><a href="?branch=<?php
echo $branch;
?>
"><?php
echo $branch;
?>
</a> | <a href="?history=<?php
echo $branch;
?>
">history</a> </li>
<?php
}
?>
</ul>