Basically, i would like to echo out something along 开发者_开发百科the lines of <p style="color:FFFFFF">
, or possibly a class, but it seems the parser isn't really liking the fact that it contains quotes, and it quickly destroys my site. Is there any hack to get around the parser rules, alternatively a better solution?
Cheers.
echo '<p style="color:#000;">test</p>';
or
echo "<p style=\"color:#000;\">test</p>';
and a couple other combinations are possible. The point is that you should take into account what quotes you're using to spit out the entire string, and which quotes are used in the HTML. If you need to use the same ones, " and " you have to escape the inner " or the parser will think that denotes the end of the string.
Simply escape your quotes:
echo "<p style=\"color:FFFFFF\">";
You could also
echo "<p style='color:#FFFFFF'>";
or perhaps:
echo '<p style="color:#fff">test</p>';
精彩评论