获取天气-步骤10-底线。。。
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了获取天气-步骤10-底线。。。相关的知识,希望对你有一定的参考价值。
//back to our "black roots"... class WeatherService{ private $cache; public function WeatherService(){ //some initialization... $cache = new DBCache(); //******** THE ONLY THING CHANGED !!!!!!!!!!!!!!!!! } public function getWeatherInfo($city, $method){ if ($cache->get($city)) return $cache->get($city); if ($methos=="CL") return convertFrToC($res); return $res; } private function convertFrToC($val){ return (($val+40)*5/9)-40; } }
以上是关于获取天气-步骤10-底线。。。的主要内容,如果未能解决你的问题,请参考以下文章