本文整理汇总了PHP中print_vars函数的典型用法代码示例。如果您正苦于以下问题:PHP print_vars函数的具体用法?PHP print_vars怎么用?PHP print_vars使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_vars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: custom_port_parser
function custom_port_parser($port)
{
global $debug;
if ($debug) {
echo $port['ifAlias'];
}
list($type, $descr) = preg_split("/[\\:\\[\\]\\{\\}\\(\\)]/", $port['ifAlias']);
list(, $circuit) = preg_split("/[\\{\\}]/", $port['ifAlias']);
list(, $notes) = preg_split("/[\\(\\)]/", $port['ifAlias']);
list(, $speed) = preg_split("/[\\[\\]]/", $port['ifAlias']);
$descr = trim($descr);
$port_ifAlias = array();
if ($type && $descr) {
$type = strtolower($type);
$port_ifAlias['type'] = $type;
$port_ifAlias['descr'] = $descr;
$port_ifAlias['circuit'] = $circuit;
$port_ifAlias['speed'] = $speed;
$port_ifAlias['notes'] = $notes;
}
if ($debug && count($port_ifAlias)) {
print_vars($port_ifAlias);
}
return $port_ifAlias;
}
示例2: api_show_debug
/**
* Show the debug information
*
* @param txt
* @param value
*
*/
function api_show_debug($txt, $value)
{
global $vars;
if ($vars['debug']) {
echo "<pre>\n";
echo "DEBUG " . $txt . ":\n";
print_vars($value);
echo "</pre>\n";
}
}
示例3: print_vars
function print_vars($obj)
{
$arr = get_object_vars($obj);
while (list($prop, $val) = each($arr)) {
if (class_exists($val)) {
print_vars($val);
} else {
echo "\t {$prop} = {$val}\n<br />";
}
}
}
示例4: print_sql
function print_sql($query)
{
if ($GLOBALS['cli']) {
print_vars($query);
} else {
if (class_exists('SqlFormatter')) {
// Hide it under a "database icon" popup.
#echo overlib_link('#', '<i class="oicon-databases"> </i>', SqlFormatter::highlight($query));
echo '<p>', SqlFormatter::highlight($query), '</p>';
} else {
print_vars($query);
}
}
}
示例5: getLastMeasurement
function getLastMeasurement($bill_id)
{
$row = dbFetchRow("SELECT timestamp,delta,in_delta,out_delta FROM bill_data WHERE bill_id='" . mres($bill_id) . "' ORDER BY timestamp DESC LIMIT 0,1");
print_vars($row);
if (is_numeric($row['delta'])) {
$return['delta'] = $row['delta'];
$return['delta_in'] = $row['delta_in'];
$return['delta_out'] = $row['delta_out'];
$return['timestamp'] = $row['timestamp'];
$return['state'] = "ok";
} else {
$return['state'] = "failed";
}
return $return;
}
示例6: custom_port_parser
function custom_port_parser($port)
{
global $config;
print_debug($port['ifAlias']);
// Pull out Type and Description or abort
if (!preg_match('/^([^:]+):([^\\[\\]\\(\\)\\{\\}]+)/', $port['ifAlias'], $matches)) {
return array();
}
// Munge and Validate type
$types = array('core', 'peering', 'transit', 'cust', 'server', 'l2tp');
foreach ($config['int_groups'] as $custom_type) {
$types[] = strtolower(trim($custom_type));
}
$type = strtolower(trim($matches[1], " \t\n\r\v\\/\"'"));
if (!in_array($type, $types)) {
return array();
}
# Munge and Validate description
$descr = trim($matches[2]);
if ($descr == '') {
return array();
}
if (preg_match('/\\{(.*)\\}/', $port['ifAlias'], $matches)) {
$circuit = $matches[1];
}
if (preg_match('/\\[(.*)\\]/', $port['ifAlias'], $matches)) {
$speed = $matches[1];
}
if (preg_match('/\\((.*)\\)/', $port['ifAlias'], $matches)) {
$notes = $matches[1];
}
$port_ifAlias = array();
$port_ifAlias['type'] = $type;
$port_ifAlias['descr'] = $descr;
$port_ifAlias['circuit'] = $circuit;
$port_ifAlias['speed'] = $speed;
$port_ifAlias['notes'] = $notes;
if (OBS_DEBUG > 1) {
print_vars($port_ifAlias);
}
return $port_ifAlias;
}
示例7: mydebug
function mydebug($line, $file, $vars)
{
$debug = $GLOBALS['debug'];
if ($debug) {
print "<i>Debugging line {$line} of script {$file}</i>.<br>";
$type = gettype($vars);
switch ($type) {
case 'array':
foreach ($vars as $k => $v) {
print "{$k}: {$v}<br>";
}
break;
case 'object':
print_vars($vars);
break;
default:
print $vars;
}
}
}
示例8: snmpwalk_cache_oid
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
$oids = snmpwalk_cache_oid($device, 'oaSfpDiagnosticTemperature', array(), 'OA-SFP-MIB');
$oids = snmpwalk_cache_oid($device, 'oaSfpDiagnosticVcc', $oids, 'OA-SFP-MIB');
$oids = snmpwalk_cache_oid($device, 'oaSfpDiagnosticTxBias', $oids, 'OA-SFP-MIB');
$oids = snmpwalk_cache_oid($device, 'oaSfpDiagnosticTxPower', $oids, 'OA-SFP-MIB');
$oids = snmpwalk_cache_oid($device, 'oaSfpDiagnosticRxPower', $oids, 'OA-SFP-MIB');
if (OBS_DEBUG > 1) {
print_vars($oids);
}
foreach ($oids as $index => $entry) {
list($mrvslot, $mrvport) = explode('.', $index);
$xdescr = "Slot {$mrvslot} port {$mrvport}";
unset($mrvslot, $mrvport);
if ($entry['oaSfpDiagnosticTemperature'] != 'empty') {
$descr = $xdescr . ' DOM Temperature';
$scale = 0.1;
$oid = ".1.3.6.1.4.1.6926.1.18.1.1.3.1.3.{$index}";
$value = intval($entry['oaSfpDiagnosticTemperature']);
if ($value != 0) {
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'lambdadriver-dom-temp', $descr, $scale, $value);
}
}
if ($entry['oaSfpDiagnosticVcc'] != 'empty') {
示例9: snmpwalk_cache_threepart_oid
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @author Adam Armstrong <adama@observium.org>
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
$lldp_array = snmpwalk_cache_threepart_oid($device, "lldpRemoteSystemsData", array(), "LLDP-MIB", NULL, OBS_SNMP_ALL | OBS_SNMP_CONCAT);
if ($lldp_array) {
if (OBS_DEBUG > 1) {
print_vars($lldp_array);
}
$dot1d_array = snmpwalk_cache_oid($device, "dot1dBasePortIfIndex", array(), "BRIDGE-MIB");
$lldp_local_array = snmpwalk_cache_oid($device, "lldpLocalSystemData", array(), "LLDP-MIB");
foreach ($lldp_array as $key => $lldp_if_array) {
foreach ($lldp_if_array as $entry_key => $lldp_instance) {
if (is_numeric($dot1d_array[$entry_key]['dot1dBasePortIfIndex']) && $device['os'] != "junos") {
$ifIndex = $dot1d_array[$entry_key]['dot1dBasePortIfIndex'];
} else {
$ifIndex = $entry_key;
}
// Get the port using BRIDGE-MIB
$port = dbFetchRow("SELECT * FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ? AND `ifDescr` NOT LIKE 'Vlan%'", array($device['device_id'], $ifIndex));
// If BRIDGE-MIB failed, get the port using pure LLDP-MIB
if (!$port) {
$ifName = $lldp_local_array[$entry_key]['lldpLocPortDesc'];
示例10: snmpwalk_cache_oid
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
// EMBEDDED-NGX-MIB
if (!is_array($cache_storage['embedded-ngx-mib'])) {
$cache_storage['embedded-ngx-mib'] = snmpwalk_cache_oid($device, "swStorage", NULL, "EMBEDDED-NGX-MIB");
if (OBS_DEBUG && count($cache_storage['embedded-ngx-mib'])) {
print_vars($cache_storage['embedded-ngx-mib']);
}
}
$entry = $cache_storage['embedded-ngx-mib'][$storage['storage_index']];
$storage['units'] = 1024;
$storage['size'] = $entry['swStorageConfigTotal'] * $storage['units'];
$storage['free'] = $entry['swStorageConfigFree'] * $storage['units'];
$storage['used'] = $storage['size'] - $storage['free'];
// EOF
示例11: snmpwalk_cache_oid
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
// Note. $cache_discovery['ucd-snmp-mib'] - is cached 'UCD-SNMP-MIB::dskEntry' (see ucd-snmp-mib.inc.php in current directory)
$mib = 'HOST-RESOURCES-MIB';
if (!isset($cache_discovery['host-resources-mib'])) {
$cache_discovery['host-resources-mib'] = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES", mib_dirs());
if (OBS_DEBUG && count($cache_discovery['host-resources-mib'])) {
print_vars($cache_discovery['host-resources-mib']);
}
}
if (count($cache_discovery['host-resources-mib'])) {
echo " {$mib} ";
foreach ($cache_discovery['host-resources-mib'] as $index => $storage) {
$hc = 0;
$mib = 'HOST-RESOURCES-MIB';
$fstype = $storage['hrStorageType'];
$descr = $storage['hrStorageDescr'];
$units = $storage['hrStorageAllocationUnits'];
$deny = FALSE;
switch ($fstype) {
case 'hrStorageVirtualMemory':
case 'hrStorageRam':
case 'hrStorageOther':
示例12: print_r
echo '<td><i class="icon-remove-sign red"></i></td>';
}
if (is_array($config['graph_types']['device'][$graph_entry['graph']])) {
echo '<td><i class="icon-ok-sign green"></i></td>';
} else {
echo '<td><i class="icon-remove-sign red"></i></td>';
}
if ($graph_entry['enabled']) {
echo '<td><i class="icon-ok-sign green"></i></td>';
} else {
echo '<td><i class="icon-remove-sign red"></i></td>';
}
echo '<td>' . print_r($config['graph_types']['device'][$graph_entry['graph']], TRUE) . '</td>';
echo '</tr>';
}
?>
</table>
</div>
<div class="well info_box">
<?php
print_vars($device);
?>
</div>
</div>
</div>
<?php
} else {
include "includes/error-no-perm.inc.php";
}
// EOF
示例13: strtotime
$vars['from'] = strtotime($vars['timestamp_from']);
unset($vars['timestamp_from']);
}
if (isset($vars['timestamp_to']) && preg_match($timestamp_pattern, $vars['timestamp_to'])) {
$vars['to'] = strtotime($vars['timestamp_to']);
unset($vars['timestamp_to']);
}
if (!is_numeric($vars['from'])) {
$vars['from'] = $config['time']['day'];
}
if (!is_numeric($vars['to'])) {
$vars['to'] = $config['time']['now'];
}
preg_match('/^(?P<type>[a-z0-9A-Z-]+)_(?P<subtype>.+)/', $vars['type'], $graphtype);
if (OBS_DEBUG) {
print_vars($graphtype);
}
$type = $graphtype['type'];
$subtype = $graphtype['subtype'];
if (is_numeric($vars['device'])) {
$device = device_by_id_cache($vars['device']);
} elseif (!empty($vars['device'])) {
$device = device_by_name($vars['device']);
}
if (is_file($config['html_dir'] . "/includes/graphs/" . $type . "/auth.inc.php")) {
include $config['html_dir'] . "/includes/graphs/" . $type . "/auth.inc.php";
}
if (!$auth) {
print_error_permission();
return;
}
示例14: snmpwalk_cache_oid
if ($GLOBALS['snmp_status']) {
$radios_snmp = snmpwalk_cache_oid($device, 'ruckusRadioStatsTable', array(), 'RUCKUS-RADIO-MIB');
if (OBS_DEBUG > 1) {
print_vars($radios_snmp);
}
}
$polled = time();
// Goes through the SNMP radio data
foreach ($radios_snmp as $radio_number => $radio) {
$radio['polled'] = $polled;
$radio['radio_number'] = $radio_number;
$radio['radio_ap'] = 0;
// Hardcoded since the AP is self.
$radio['radio_clients'] = $radio['ruckusRadioStatsNumSta'];
if (OBS_DEBUG && count($radio)) {
print_vars($radio);
}
// FIXME -- This is Ruckus only and subject to change. RRD files may be wiped as we modify this format to fit everything.
$dses = array('assoc_fail_rate' => array('oid' => 'ruckusRadioStatsAssocFailRate', 'type' => 'gauge'), 'auth_success_rate' => array('oid' => 'ruckusRadioStatsAssocSuccessRate', 'type' => 'gauge'), 'auth_fail_rate' => array('oid' => 'ruckusRadioStatsAuthFailRate', 'type' => 'gauge'), 'max_stations' => array('oid' => 'ruckusRadioStatsMaxSta', 'type' => 'gauge'), 'assoc_fail' => array('oid' => 'ruckusRadioStatsNumAssocFail'), 'assoc_req' => array('oid' => 'ruckusRadioStatsNumAssocReq'), 'assoc_resp' => array('oid' => 'ruckusRadioStatsNumAssocResp'), 'assoc_success' => array('oid' => 'ruckusRadioStatsNumAssocSuccess'), 'auth_fail' => array('oid' => 'ruckusRadioStatsNumAuthFail'), 'auth_req' => array('oid' => 'ruckusRadioStatsNumAuthReq'), 'auth_resp' => array('oid' => 'ruckusRadioStatsNumAuthResp'), 'auth_stations' => array('oid' => 'ruckusRadioStatsNumAuthSta', 'type' => 'gauge'), 'auth_success' => array('oid' => 'ruckusRadioStatsNumAuthSuccess'), 'num_stations' => array('oid' => 'ruckusRadioStatsNumSta', 'type' => 'gauge'), 'resource_util' => array('oid' => 'ruckusRadioStatsResourceUtil', 'type' => 'gauge'), 'rx_bytes' => array('oid' => 'ruckusRadioStatsRxBytes'), 'rx_decrypt_crcerr' => array('oid' => 'ruckusRadioStatsRxDecryptCRCError'), 'rx_errors' => array('oid' => 'ruckusRadioStatsRxErrors'), 'rx_frames' => array('oid' => 'ruckusRadioStatsRxFrames'), 'rx_mic_error' => array('oid' => 'ruckusRadioStatsRxMICError'), 'rx_wep_fail' => array('oid' => 'ruckusRadioStatsRxWEPFail'), 'tx_bytes' => array('oid' => 'ruckusRadioStatsTxBytes'), 'tx_frames' => array('oid' => 'ruckusRadioStatsTxFrames'), 'total_airtime' => array('oid' => 'ruckusRadioStatsTotalAirtime'), 'total_assoc_time' => array('oid' => 'ruckusRadioStatsTotalAssocTime'), 'busy_airtime' => array('oid' => 'ruckusRadioStatsBusyAirtime'));
$rrd_file = 'wifi-radio-' . $radio['radio_ap'] . '-' . $radio['radio_number'] . '.rrd';
$rrd_update = 'N';
$rrd_create = '';
foreach ($dses as $ds => $ds_data) {
$oid = $ds_data['oid'];
$radio[$ds] = $radio[$oid];
if ($ds_data['type'] == 'gauge') {
$rrd_create .= ' DS:' . $ds . ':GAUGE:600:U:100000000000';
} else {
$rrd_create .= ' DS:' . $ds . ':COUNTER:600:U:100000000000';
}
if (is_numeric($radio[$oid])) {
示例15: unset
}
}
unset($processors_array, $processor, $dot_index, $descr, $i);
// Clean up
if (isset($entry['stop_if_found']) && $entry['stop_if_found'] && $entry['found']) {
break;
}
// Stop loop if processor found
}
}
}
// Remove processors which weren't redetected here
foreach (dbFetchRows('SELECT * FROM `processors` WHERE `device_id` = ?', array($device['device_id'])) as $test_processor) {
$processor_index = $test_processor['processor_index'];
$processor_type = $test_processor['processor_type'];
$processor_descr = $test_processor['processor_descr'];
print_debug($processor_index . " -> " . $processor_type);
if (!$valid['processor'][$processor_type][$processor_index]) {
$GLOBALS['module_stats'][$module]['deleted']++;
//echo('-');
dbDelete('processors', '`processor_id` = ?', array($test_processor['processor_id']));
log_event("Processor removed: type " . $processor_type . " index " . $processor_index . " descr " . $processor_descr, $device, 'processor', $test_processor['processor_id']);
}
unset($processor_oid);
unset($processor_type);
}
$GLOBALS['module_stats'][$module]['status'] = count($valid['processor']);
if (OBS_DEBUG && $GLOBALS['module_stats'][$module]['status']) {
print_vars($valid['processor']);
}
// EOF