1 | require('sag-master/src/Sag.php'); |
1 2 3 4 5 6 7 8 | // vcap_services Extraction $services_json = json_decode(getenv('VCAP_SERVICES'),true); $VcapSvs = $services_json["user-provided"][0]["credentials"]; // Extract the VCAP_SERVICES variables for Cloudant connection. $myUsername = $VcapSvs["username"]; $myPassword = $VcapSvs["password"]; // Create the URL for the SAG PHP utility. $myUrl = ($myUsername . ".cloudant.com"); |
1 2 | $sag = new Sag($myUrl); $sag->login($myUsername, $myPassword); |
1 | $sag->setDatabase('gauge'); |
1 | $resp = $sag->get('Gauge-Data')->body->GaugeValue; |
1 2 3 4 | var gaugeData = google.visualization.arrayToDataTable([ ['Label', 'Value'], ['Value', <?php echo $resp; ?>] ]); |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |