我似乎无法弄清楚如何将其更改为在echo语句中正确输出。任何人都可以帮我一把吗?感谢。
<img src="<?= get_template_directory_uri(); ?>/img/teams/<?= urlencode( $home_team ); ?>.png" alt="<?= $home_team; ?>" width="86" />
答案 0 :(得分:1)
echo '<img src="' . get_template_directory_uri() . '/img/teams/' . urlencode( $home_team ) . '.png" alt="' . $home_team .'" width="86" />';
或
printf('<img src="%s"/img/teams/%s.png" alt="%s" width="86" />', get_template_directory_uri(), urlencode( $home_team ), $home_team);