%d 0 '; $result = sprintf($template, $object->FromUserName, $object->ToUserName, $object->CreateTime, $object->Content); return $result; } public static function image($object) { $template = ' %d '; $result = sprintf($template, $object->FromUserName, $object->ToUserName, $object->CreateTime, $object->MediaId); return $result; } public static function news($object, array $array) { $template = ' <![CDATA[%s]]> '; $item = null; foreach ($array as $value) { $item .= sprintf($template, @$value['Title'], @$value['Description'], @$value['PicUrl'], @$value['Url']); } $template = ' %d %d %s '; $result = sprintf( $template, $object->FromUserName, $object->ToUserName, $object->CreateTime, count($array), $item ); return $result; } }