<?php
//On exécute la commande de récupérage (si si) de température
$temp = exec('cat /sys/class/thermal/thermal_zone0/temp');
//On divise par 1000 pour convertir
$tempconv = $temp / 1000;
//Un chiffre après la virgule ça suffit
$temppi = round($tempconv,1);
//On définit les variables d'affichage dans la condition suivante en y affichant la température
$ok = '<link href="raspiok.css" media="all" rel="stylesheet" type="text/css" />'. $temppi .'°C ';
$wrong = '<link href="raspiwrong.css" media="all" rel="stylesheet" type="text/css" />'. $temppi .'°C ';
//Si la température < 65°C alors on affiche en vert, sinon en rouge
echo 'Temp CPU</br>';
if ($temppi < 50.0)
echo $ok ;
else
echo $wrong ;
?>