for ($i=1;$i<=$counter_len;$i++)
   {    echo "<img src='img/" .substr($counter,$i-1,1) . ".gif'>";//这里少了个"."
   }