使用数组改变身体背景颜色?

I'm trying to change the body background colour using php, with the colours in the array.

Here is the code:

 <?php 
   $days = array("blue", "green", "red", "Yellow", "Black", "aqua", "white"); 
   //$today = date('w'); 
   echo "<body style="background-color:' + $days[1] + "\"/>";
   ?>

It looks like it should work to me but it doesn't.

Try it like

   echo '<body style="background-color:' . $days[1] . ';">';

In PHP concatination will be done by . operator where as in javascript it will be taken by + operator

You are using a wrong concatenation operator. Make + to .

echo '<body style="background-color:', $days[1], ';">';
// Don't concat on echo! Use "," instead of ".".