我有以下代码,它显示了一些错误,如下所述:
$ListNames = @('DL – Clinical Lab Supervisors','DL - Clinical Lab Rats')
foreach($ListName in $ListNames){
$name = $ListName -replace '\p{Pd}','-'
Get-ADGroup $name
}
它显示:
注意:未定义的变量:内容 C:\ WAMP \ WWW \ WordPress的\可湿性粉剂内容\主题\ testtheme \框架\联赛\ table.php 在第98行
第98行是:
\p{Pd}
注意:未定义的索引:FC Barcelona in C:\ WAMP \ WWW \ WordPress的\可湿性粉剂内容\主题\ testtheme \框架\联赛\ table.php 在131线 第131行是:
<?php
$terms = wp_get_post_terms( $post->ID, array('competition', 'season') );
$term_slugs = wp_list_pluck( $terms, 'slug' );
$season = wp_get_post_terms( $post->ID, 'season' );
$season_slugs = wp_list_pluck( $terms, 'slug' );
$args = array(
'post_type' => array( 'football_fixture' ),
'tax_query' => array(
array(
'taxonomy' => 'competition',
'field' => 'slug',
'terms' => $term_slugs
),
array (
'taxonomy' => 'season',
'terms' => $season_slugs,
'field' => 'slug')
),
'meta_query' => array(
array(
'key' => 'pb_match_status',
'value' => 'ft'
),
)
);
$my_query = null;
$my_query = new WP_Query($args);
$temp_teams_home=array();
$temp_teams_away=array();
$winning_team=array();
$losing_team=array();
$drawn_team=array();
$league_ids=array();
$season_ids=array();
$total_goals=[];
while ($my_query->have_posts()) : $my_query->the_post();
$temp_teams_home[] = get_post_meta( get_the_ID(), 'match_details_home_team', true );
$temp_teams_away[] = get_post_meta( get_the_ID(), 'match_details_away_team', true );
$home_team = get_post_meta( get_the_ID(), 'match_details_home_team', true );
$away_team = get_post_meta( get_the_ID(), 'match_details_away_team', true );
$home_goals = get_post_meta( get_the_ID(), 'pb_home_score', true );
$away_goals = get_post_meta(get_the_ID(), 'pb_away_score', true );
if($home_goals > $away_goals){
$winning_team[]=$home_team;
$losing_team[]=$away_team;
}
if($home_goals < $away_goals){
$winning_team[]=$away_team;
$losing_team[]=$home_team;
}
if ($home_goals == $away_goals){
$drawn_team[]=$home_team;
$drawn_team[]=$away_team;
}
$total_goals_scored[]=array($home_team=>$home_goals,$away_team=>$away_goals);
$total_goals_condeded[]=array($home_team=>$away_goals,$away_team=>$home_goals);
endwhile;
$total_matches_played = array_count_values(array_merge($temp_teams_home,$temp_teams_away));
$team_wins = array_count_values($winning_team);
$team_loses = array_count_values($losing_team);
$team_drawn = array_count_values($drawn_team);
$total_goals_scored_by_teams=get_single_team_total($total_goals_scored);
$total_goals_condeded_by_teams=get_single_team_total($total_goals_condeded);
$total_points=0;
$team_points=[];
$team_points2=[];
$team_points3=[];
foreach($team_wins as $tw_key=>$tw_val){
$team_points[$tw_key]=$tw_val*3;
}
foreach($team_drawn as $tw_key=>$tw_val){
$team_points2[$tw_key]=$tw_val*1;
}
$total_points_final = array();
$total_points_final2 = array();
foreach (array_keys($team_points + $team_points2) as $key) {
$total_points_final[$key] = (isset($team_points[$key]) ? $team_points[$key] : 0) + (isset($team_points2[$key]) ? $team_points2[$key] : 0);
}
foreach($team_loses as $tw_key=>$tw_val){
$team_points3[$tw_key]=$tw_val*0;
}
foreach (array_keys($total_points_final + $team_points3) as $key) {
$total_points_final2[$key] = (isset($total_points_final[$key]) ? $total_points_final[$key] : 0) + (isset($team_points3[$key]) ? $team_points3[$key] : 0);
}
$result=generate_table_details($total_matches_played,$team_wins,$team_loses,$team_drawn,$total_goals_scored_by_teams,$total_goals_condeded_by_teams,$total_points_final2);
$content.='<table class="leaguetable">';
$content.='<thead class="leaguetable-head">';
$content.='<tr>';
$content.='<th class="pos-head" data-toggle="tooltip" data-placement="top" title="Position">Pos</th>';
$content.='<th class="team-head">Team</th>';
$content.='<th class="played-head">GP</th>';
$content.='<th class="own-head">W</th>';
$content.='<th class="drawn-head">D</th>';
$content.='<th class="lost-head">L</th>';
$content.='<th class="gf-head">GF</th>';
$content.='<th class="ga-head">GA</th>';
$content.='<th class="gd-head">GD</th>';
$content.='<th class="points-head">Pts</th>';
$content.='</tr>';
$content.='</thead>';
$content.='<tbody class="table-body">';
for($i=0;$i<sizeof($result['team_list']);$i++){
$content.='<tr>';
$win_res;
if($result['total_wins'][$result['team_list'][$i]]!=''){
$win_res=$result['total_wins'][$result['team_list'][$i]];
} else {
$win_res=0;
}
$draw_res;
if($result['team_drawn'][$result['team_list'][$i]]!=''){
$draw_res=$result['team_drawn'][$result['team_list'][$i]];
} else {
$draw_res=0;
}
$loss_res;
if($result['total_loses'][$result['team_list'][$i]]!=''){
$loss_res=$result['total_loses'][$result['team_list'][$i]];
} else {
$loss_res=0;
}
$gf;
if($result['total_goals_for'][$result['team_list'][$i]]!=''){
$gf=$result['total_goals_for'][$result['team_list'][$i]];
} else {
$gf=0;
}
$ga;
if($result['total_goals_against'][$result['team_list'][$i]]!=''){
$ga=$result['total_goals_against'][$result['team_list'][$i]];
} else {
$ga=0;
}
$gd= ($gf-$ga);
$tot_points;
if($result['team_points'][$result['team_list'][$i]]!=''){
$tot_points=$result['team_points'][$result['team_list'][$i]];
} else {
$tot_points=0;
}
$tot_points;
if($result['team_points'][$result['team_list'][$i]]!=''){
$tot_points=$result['team_points'][$result['team_list'][$i]];
} else {
$tot_points=0;
}
$content.='<td class="team-pos" >'.$result['team_postiion'][$result['team_list'][$i]].'</td>';
$content.='<td class="team-logo-name"><img src="'.get_team_image_from_title($result['team_list'][$i]).'" style="height:30px; width:30px;"/>'.$result['team_list'][$i].'</td>';
$content.='<td class="team-played">'.$result['total_matches_played'][$result['team_list'][$i]].'</td>';
$content.='<td class="team-win">'.$win_res.'</td>';
$content.='<td class="team-draw">'.$draw_res.'</td>';
$content.='<td class="team-loss">'.$loss_res.'</td>';
$content.='<td class="team-gf">'.$gf.'</td>';
$content.='<td class="team-ga">'.$ga.'</td>';
$content.='<td class="team-gd">'.$gd.'</td>';
$content.='<td class="team-points">'.$tot_points.'</td>';
$content.='</tr>';
}
$content.='</tbody>';
$content.='</table>';
echo $content;
?>
注意:未定义的索引:塞维利亚 C:\ WAMP \ WWW \ WordPress的\可湿性粉剂内容\主题\ testtheme \框架\联赛\ table.php 在第124行 第124行是:
$content.='<table class="leaguetable">';
有什么解决方案吗? 任何帮助将不胜感激。