我对json和数组很陌生,我有以下内容,但是我没有从Jenkins JSON输出中得到任何结果。
链接到输出-http://resonant-rise.com/mcupdater/parser.php
代码
$url = "http://jenkins.jakimfett.com/job/AlchemyPlusPlus/lastSuccessfulBuild/api/json?pretty=true";
$output = json_decode(file_get_contents($url), true);
print "<pre>";
print_r($output);
print "</pre>";
foreach ($output->actions as $item) {
echo $item->fullDisplayName . "\n";
}
<?php
$url="http://jenkins.jakimfett.com/job/AlchemyPlusPlus/lastSuccessfulBuild/api/json?pretty=true";
$output = json_decode(file_get_contents($url), true);
echo "<pre>";
print_r($output);
echo "</pre>";
/* for properties like fullDisplayName, id, keeplog etc .. directly use echo */
echo $output['fullDisplayName'];
/* for properties like actions and artifacts */
foreach($output['actions'] as $action){
print_r($action); /* actions itself is array so use print_r */
}
?>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句