为什么foreach循环输出双组li标签?

Apologies for the noob question, but...

In wordpress 3.2.1, using wp-e-commerce:

I'm using the following code to output a field from an indexed array as an unordered list.

function tag_badges() {
  global $wpdb, $post;
  $tags = wp_get_product_tags($post->ID);
  foreach($tags as $key)
    // print_r ($key->name);
  echo "<li>$key->name<li/>";
}

This sort of works. But I'm getting an empty set of li tags for every tag that has a set.

e.g.

value1 value2 value3

When I output just the keys without markup, it just returns the three values that are in the array, e.g.

Key: Value1 Key: Value2 Key: Value3

so I'm fairly sure it's not because there are empty fields being output.

You just did a minor error in your output, you didn't close the li tag but added a new one:

echo "<li>$key->name<li/>";
#                      ^

To fix, move the / to the beginning of the second li tag to make it actually a closing tag:

echo "<li>$key->name</li>";
#                    ^