小编zyM*_*cro的帖子

在php printf函数中更改表的颜色时发生错误

我想使用printf函数更改php文件中表格文本的颜色.但是当我使用这两种方法时,我失败了.你能告诉我怎么会发生这种情况?我怎样才能改变颜色?方法A:

 <?php   
      printf('<tr>');  
      printf('<td><font color='red'>abc</font></td>');  
      printf('</tr>');
  ?>
Run Code Online (Sandbox Code Playgroud)

方法B:

 <?php
  printf('<tr>');
  printf('<td style="color:red">abc</td>');
  printf('</tr>');
 ?>
Run Code Online (Sandbox Code Playgroud)

PS:原始问题:(这是代码的一部分)

 $userrow = mysql_fetch_array($userqueryresult);
            $thisuserid = $userrow[0];
            $user_type=$userrow[1];

printf("   <td valign = 'center'  width='40%%'>
<a href='show_user.php?u=%d'>
<font color='red'>%s</font></a></td>\n",$thisuserid, $key);
Run Code Online (Sandbox Code Playgroud)

事实上,当我使用color ="red"时,它会失败而color ='red',它有效."""和""之间有什么区别吗?但正如Julie Pelletier所说,"abc"它起作用了.这也是""".

html php printf html-table

3
推荐指数
1
解决办法
50
查看次数

标签 统计

html ×1

html-table ×1

php ×1

printf ×1