Google Weather API温度转换

Adn*_*nan 3 php xml weather-api google-weather-api

谷歌天气API显示华氏温度.

看完这篇文章后,我能够将温度从F转换为C.

但是,它表现得像17.222222222222° C - 28.888888888889° C, Clear.我怎么才能做到这一点17° C-28° C.

提前致谢.

ajr*_*eal 7

function toCelsius($deg)
{
  return floor(($deg-32)/1.8);
}
Run Code Online (Sandbox Code Playgroud)

如有必要,可以通过舍入值来使用floor返回下一个最小整数值.