我错过了什么,还尝试提供函数参数并插入 $poolstale_enc_json 但这也会产生错误?
$poolstale_get_json = file_get_contents('../scripts/PoolStale');
$poolstale_enc_json = json_decode($poolstale_get_json);
$poolstale_enc_val = array();
$poolstale_enc_date = array();
function get_val_value(){
foreach($poolstale_enc_json as $tmp){
array_push($poolstale_enc_val,$tmp[1]);
// print_r($poolstale_enc_val); echo "</br>";
}
return $poolstale_enc_val;
}
function get_val_date(){
foreach($poolstale_enc_json as $tmp){
array_push($poolstale_enc_date,$tmp[2]);
// print_r($poolstale_enc_date); echo "</br>";
}
return $poolstale_enc_date;
}
get_val_date();
错误是:
Notice: Undefined variable: poolstale_enc_json in /opt/lampp/htdocs/scripts/chart-data.php on line 90
Warning: Invalid argument supplied for foreach() in /opt/lampp/htdocs/scripts/chart-data.php on line 90
Notice: Undefined variable: poolstale_enc_date in /opt/lampp/htdocs/scripts/chart-data.php on line 94