获取天气-步骤4-增强封装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了获取天气-步骤4-增强封装相关的知识,希望对你有一定的参考价值。
class WeatherService{ public function WeatherService(){ //some initialization... } public function getWeatherInfo($city, $method=""){ if ($methos=="CL") return convertFrToC($res); return $res; } public static function convertFrToC($val){ return (($val+40)*5/9)-40; } } //now it can also be used independently of the rest of the WeatherService //functions and main purpose... $c = WeatherService::convertFrToC(22);
以上是关于获取天气-步骤4-增强封装的主要内容,如果未能解决你的问题,请参考以下文章