日期:2014-05-17  浏览次数:20509 次

求正确写法
直接看代码:
PHP code

    while ($row=mysql_fetch_row($result))
    {
      for ($i=0; $i<mysql_num_fields($result); $i++ )
      {
        echo '<a href="../products/index.php?pclass=$row[$i]">';//这一行,plass=后面应该怎么写才符合规范?
        echo "$row[$i]";
        echo '</a>';
      }
    }


谢谢

------解决方案--------------------
echo "<a href='../products/index.php?pclass=$row[$i]'>";
------解决方案--------------------
Note: 不像双引号 和heredoc语法结构, 在单引号字符串中的变量 和特殊含义的字符将 不会 被替换。
http://www.php.net/manual/zh/language.types.string.php
------解决方案--------------------
echo "<a href='../products/index.php?pclass={$row[$i]}'>";