How to set the background color in PHP?
To set the background color of an HTML page in PHP, you can use the following code:
<?php
$color = "red"; // 设置背景颜色为红色
// 输出HTML页面
echo "<html>";
echo "<head>";
echo "<style>";
echo "body { background-color: ".$color."; }"; // 使用变量设置背景颜色
echo "</style>";
echo "</head>";
echo "<body>";
echo "</body>";
echo "</html>";
?>
In the code above, we use the $color variable to set the background color. You can change the value of $color as needed to alter the background color.