php设计模式-适配器
// 数据源类
class Weather { public static function getWether() { $data = array( 'tep' => 28, 'wind' => 5, 'sun' => 'sunny' ); return serialize($data); } }
// 适配不同客户端 class Adapter extends Weather { public static function getWether() { return $data = json_encode(unserialize(parent::getWether())); } } echo '<br>'; print_r(Adapter::getWether());