简体   繁体   中英

how to apply bgcolor in table using echo command

I want to apply background colour to a table. I have written table using echo command , but am confused about how to apply bgcolor can any one guide me..

print("<table align='center' width='50%' border=1> ");
echo "<TR><TD> Sr.No </td>";
echo "<td  width=\"16%\" bgcolor=\"#CCCCCC\"> delete</td>";
echo "<Td> File Name </td> ";
echo "<td> Share It </td>";
echo "</tr></table>";
echo '<tr><td> Sr.No</td>';
echo '<td width="16%" bgcolor="' . $colorVariable .  '"> delete</td>';
echo '<td> File Name </td>';
echo '<td> Share It</td></tr>';

“这是碰撞。你需要逃脱角色,如下所示。

echo"<td  width=\"16%\" bgcolor=\"#CCCCCC\"> delete</td>";

try

echo '<td  width="16%" bgcolor="#CCCCCC"> delete</td>';

PHP double quote and single quote

$some="Oh god";

echo "My answer is $some ";

//result is: My answer is Oh god

In the above, using double quotes, the variable $someis evaluated within the quotes and the result isn't what is expected: the variable is evaluated to Oh god. Variables, but not functions or constants, are evaluated even when enclosed in double quotes.

echo 'My answer is $some';

//result is: My answer is $some.

When single quotes are used, as above, the variable isn't evaluated and is printed on the screen literally as $some.


good read

Is there a performance benefit single quote vs double quote in php?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM