$tousername, 'msgtype'=>'text', 'text'=>array( 'content'=>$content, ), ); $template = json_encode($template); return Curl::callWebServer(self::$queryUrl, $template, self::$action); } public static function image($tousername, $mediaId){ //获取ACCESS_TOKEN $accessToken = AccessToken::getAccessToken(); self::$queryUrl = self::$queryUrl.$accessToken; //开始 $template = array( 'touser'=>$tousername, 'msgtype'=>'image', 'image'=>array( 'media_id'=>$mediaId, ), ); $template = json_encode($template); return Curl::callWebServer(self::$queryUrl, $template, self::$action); } public static function voice($tousername, $mediaId){ //获取ACCESS_TOKEN $accessToken = AccessToken::getAccessToken(); self::$queryUrl = self::$queryUrl.$accessToken; //开始 $template = array( 'touser'=>$tousername, 'msgtype'=>'voice', 'voice'=>array( 'media_id'=>$mediaId, ), ); $template = json_encode($template); return Curl::callWebServer(self::$queryUrl, $template, self::$action); } public static function video($tousername, $mediaId, $title, $description){ //获取ACCESS_TOKEN $accessToken = AccessToken::getAccessToken(); self::$queryUrl = self::$queryUrl.$accessToken; //开始 $template = array( 'touser'=>$tousername, 'msgtype'=>'video', 'video'=>array( 'media_id'=>$mediaId, 'title'=>$title, 'description'=>$description, ), ); $template = json_encode($template); return Curl::callWebServer(self::$queryUrl, $template, self::$action); } public static function music($tousername, $title, $description, $musicUrl, $hqMusicUrl, $thumbMediaId){ //获取ACCESS_TOKEN $accessToken = AccessToken::getAccessToken(); self::$queryUrl = self::$queryUrl.$accessToken; //开始 $template = array( 'touser'=>$tousername, 'msgtype'=>'music', 'music'=>array( 'title'=>$title, 'description'=>$description, 'musicurl'=>$musicUrl, 'hqmusicurl'=>$hqMusicUrl, 'thumb_media_id'=>$thumbMediaId, ), ); $template = json_encode($template); return Curl::callWebServer(self::$queryUrl, $template, self::$action); } public static function newsItem($title, $description, $picUrl, $url){ return $template = array( 'title'=>$title, 'description'=>$description, 'url'=>$picUrl, 'picurl'=>$url, ); } public static function news($tousername, $item){ $accessToken = AccessToken::getAccessToken(); self::$queryUrl = self::$queryUrl.$accessToken; $template = array( 'touser'=>$tousername, 'msgtype'=>'news', 'news'=>array( 'articles'=>$item ), ); $template = json_encode($template); return Curl::callWebServer(self::$queryUrl, $template, self::$action); } }