function page($x)
{
  $a=$x/10;
  $b=$x%10;  if($x<10)
  {
    return 1;;
  }
  if($b == 0)
  {
    return $x-2;
  }
  else
  {
    return $x-$b;
  }<?php 
$a=page($_GET['x']);
for($i=$a;$i<$a+10;++$i)
{
  $pages.=$i.' ';
}
echo '<a href="http://sse1.paipai.com/0,20501/s-px--201-40-80-20501--3-4-3----2-2-512-128-1-0.html#newHand" log="10">'.$pages.'</a>';
?>现在的输出形式是<a href="http://sse1.paipai.com/0,20501/s-px--201-40-80-20501--3-4-3----2-2-512-128-1-0.html#newHand" log="10">1 2 3 4 5 6 7 8 9 10 </a>我想这样输出
<a href="http://sse1.paipai.com/0,20501/s-px--201-40-80-20501--3-4-3----2-2-512-128-1-0.html#newHand" log="10">1</a>
<a href="http://sse1.paipai.com/0,20501/s-px--201-40-80-20501--3-4-3----2-2-512-128-1-0.html#newHand" log="10">2</a>
<a href="http://sse1.paipai.com/0,20501/s-px--201-40-80-20501--3-4-3----2-2-512-128-1-0.html#newHand" log="10">3</a>
<a href="http://sse1.paipai.com/0,20501/s-px--201-40-80-20501--3-4-3----2-2-512-128-1-0.html#newHand" log="10">4</a>

请高手帮我上面的代码改一下,谢了

解决方案 »

  1.   

    把<a xxx></a>写到$pages .= 里面
      

  2.   

    echo preg_replace('/\d /','<a href="http://sse1.paipai.com/0,20501/s-px--201-40-80-20501--3-4-3----2-2-512-128-1-0.html#newHand" log="10">$0</a>', $pages);
      

  3.   

    <?php 
    $a=page($_GET['x']);
    for($i=$a;$i<$a+10;++$i)
    {
    echo '<a href="http://sse1.paipai.com/0,20501/s-px--201-40-80-20501--3-4-3----2-2-512-128-1-0.html#newHand" log="10">'.$pages.'</a>';
     }?>这样不就行了吗?
    还有你的function我怎么看着有问题啊,还是我水平太低了