我们有一个网站,用于监测客户网站的性能,我们使用商业智能wordpress插件显示客户端的性能。当一个新客户机首次登录并选择他的仪表板时,我们将得到以下错误,当我们在数据库中更新时,错误会消失,但是仪表板应该第一次显示自定义消息。我使用以下sql查询
select lastsamplestatus,lasterrorat,avguptimeday,status from
selenium_script_data as ssd inner join selenium_scripts as ss
on ss.script_id=ssd.selenium_id inner join wp_users as wu on
wu.ID=ss.customer_id where wu.ID={{{user_ID}注意:未定义变量:第405行/home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php中的label_x
注意:未定义变量:第417行/home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php中的数据
警告:在第417行为/home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php中的foreach()提供无效的参数
注意:尝试在第60行的/home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/resources/nvd3/wrappers/nvd3_lineChart.php中获取非对象的属性。
注意:第154行/home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/resources/nvd3/wrappers/nvd3_lineChart.php中的未定义变量: ds
注意:试图在第154行的/home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/resources/nvd3/wrappers/nvd3_lineChart.php中获取非对象的属性。
注意:未定义变量:第158行/home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php中的表
注意:试图在第158行的/home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/functions/functions.php中获取非对象的属性。
我们想为用户显示一个正常的自定义消息,直到管理更新数据库,我不知道在哪里定制functions.php,我从商业智能插件的wordpress得到这个文件。我已经粘贴了下面的代码的一部分,任何帮助都将不胜感激。
//Assign values and labels
switch($wpbi_chart->type){
case chart::DONUT:
case chart::PIE: if(sizeof($label_x) > 0){
$wpbi_chart -> set_x_axis_labels($label_x,
$vo_chart->chart_x_labels_size,
$vo_chart->chart_x_labels_color);
}
foreach($data as $key => $value){
//Overwrite data value for pie chart in order to show labels (via pie_value object)
if(sizeof($label_x)>0){
for($idx = 0; $idx < sizeof($value); $idx++){
$value[$idx] = new pie_value($value[$idx], $label_x[$idx]);
}
}
$wpbi_chart -> set_tooltip($wpbi_dialog['charts']['pie']['tooltip']);
$wpbi_chart -> create_element($key, $value);
$wpbi_chart -> elements[$key] -> set_colours($wpbi_settings['pie-chart']['color-set']);
}
break;
case chart::BAR_STACKED: if(sizeof($label_x) > 0){
$wpbi_chart -> set_x_axis_labels($label_x,
$_POST[$wpbi_settings['parameter']['ch-x-label-size']],
$_POST[$wpbi_settings['parameter']['ch-x-label-color']]);
$wpbi_chart->x_axis_istime = (sizeof($istime_cols) > 0);
if($wpbi_chart->x_axis_istime){
$wpbi_chart->x_axis_labels->labels = $wpbi_chart->convert_to_time($wpbi_chart->x_axis_labels->labels);
}
}
$wpbi_chart-> set_y_axis_labels_color($_POST[$wpbi_settings['parameter']['ch-y-label-color']]);
$wpbi_chart-> set_y_axis_labels_size($_POST[$wpbi_settings['parameter']['ch-y-label-size']]);
foreach($data_stacked as $key => $value){
$wpbi_chart -> create_element('BAR_STACKED', $value);
$wpbi_chart -> elements['BAR_STACKED'] -> set_colours($stacked_label_color);
}
break;
case chart::STACKED_AREA:
case chart::LINE_AREA: if(sizeof($label_x) > 0){
$wpbi_chart -> set_x_axis_labels($label_x,
$vo_chart->chart_x_labels_size,
$vo_chart->chart_x_labels_color);
}
$wpbi_chart-> set_y_axis_labels_color($vo_chart->chart_y_labels_color);
$wpbi_chart-> set_y_axis_labels_size($vo_chart->chart_y_labels_size);
foreach($data as $key => $value){
$wpbi_chart -> create_element($key, $value);
$wpbi_chart -> elements[$key] -> set_colour($label_color[$key]);
$wpbi_chart -> elements[$key] -> set_fill_colour($label_color[$key]);
$wpbi_chart -> elements[$key] -> set_fill_alpha( 0.5 );
}
break;
case chart::RADAR: if(sizeof($label_x) > 0){
$wpbi_chart -> set_y_axis_labels($label_x,
$vo_chart->chart_y_labels_size,
$vo_chart->chart_y_labels_color);
}
foreach($data as $key => $value){
$wpbi_chart -> create_element($key, $value);
$wpbi_chart -> elements[$key] -> set_colour($label_color[$key]);
}
break;
case chart::BAR_HORIZONTAL: if(sizeof($label_x) > 0){
$wpbi_chart -> set_y_axis_labels($label_x,
$vo_chart->chart_y_labels_size,
$vo_chart->chart_y_labels_color);
}
$wpbi_chart-> set_x_axis_labels_color($vo_chart->chart_x_labels_color);
$wpbi_chart-> set_x_axis_labels_size($vo_chart->chart_x_labels_size);
foreach($data as $key => $value){
$wpbi_chart -> create_element($key, $value);
$wpbi_chart -> elements[$key] -> set_colour($label_color[$key]);
}
break;
default: if(sizeof($label_x) > 0){
$wpbi_chart -> set_x_axis_labels($label_x,
$vo_chart->chart_x_labels_size,
$vo_chart->chart_x_labels_color, sizeof($istime_cols) > 0);
$wpbi_chart->x_axis_istime = (sizeof($istime_cols) > 0);
echo "welcome";
} else {
$wpbi_chart->set_x_axis_labels_color($vo_chart->chart_x_labels_color);
$wpbi_chart->set_x_axis_labels_size($vo_chart->chart_x_labels_size);
}
$wpbi_chart-> set_y_axis_labels_color($vo_chart->chart_y_labels_color);
$wpbi_chart-> set_y_axis_labels_size($vo_chart->chart_y_labels_size);
foreach($data as $key => $value){
$wpbi_chart -> create_element($key, $value);
$wpbi_chart -> elements[$key] -> set_colour($label_color[$key]);
}
break;
}发布于 2015-08-08 01:16:50
好的朋友。放轻松点。
在这里,你必须注意一些事情:
显示错误是因为您的error_reporting被设置为E_ALL。如果您将其设置为下面所示,则不会显示错误。
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);但是,它不会解决代码上的错误。会把它藏起来。
2-当您看到“为foreach()提供的无效参数”时,您的代码试图迭代一个空变量。你需要找到那个文件和行,然后做些事情:
if ($yourVariable && count($yourVariable)>0)
foreache($yourVariable as $yourValue){
}它将防止使用无效变量调用foreach。
3-当它说“试图获取非对象的属性”时,在该行中,您有一个不是对象的变量。它可以是字符串,也可以是整数。或者别的什么..。只是它不是一个物体。
查看所有错误,您可以看到数据变量是空的,然后所有错误都会发生,因为代码总是与$data一起运行。尝试检查您的代码,以确保$data在开关启动前具有该值。
https://stackoverflow.com/questions/31739812
复制相似问题