我们正在建立一个监控客户网站性能的网站,我们正在使用商业智能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()提供的参数无效
注意:尝试在/home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/resources/nvd3/wrappers/nvd3_lineChart.php中获取非对象的属性第60行
注意:未定义的变量:ds在第154行的/home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/resources/nvd3/wrappers/nvd3_lineChart.php中
注意:尝试在/home/sgulechha/alert.com/wp-content/plugins/wp-business-intelligence-lite/resources/nvd3/wrappers/nvd3_lineChart.php中获取非对象的属性第154行
注意:未定义的变量:第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;
}
答案 0 :(得分:1)
你必须注意一些事情:
1 - 显示错误是因为您的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在启动开关之前具有该值。