【发布时间】:2019-12-15 12:27:57
【问题描述】:
如何让变量$text 显示为 HTML?
请看下面的代码示例:
<?php
header('Content-type: text/css');
$background = "#ffafff";
$color = "#000000";
$green = "#16a86f";
$text= '<h1>TestText</h1>';
?>
body {
background-color: <?=$background?>;
}
#logo::before{content: "<?php echo($text);?>";}
#logo {
color: <?=$green?>;
font-weight: bold;
}
#slogan {
color: <?=$color?>;
}
#rahmen {
border: 0.1em solid <?=$green?>;
text-align: center;
}
目前我得到这个输出:
【问题讨论】:
-
我不确定我是否理解您的问题,您是在问如何显示变量
$text吗? -
无法在css中输出html
content!