PHP Class PFinal\Wechat\Service\MaterialService

Inheritance: extends BaseService
Datei anzeigen Open project: pfinal/wechat Class Usage Examples

Public Methods

Method Description
uploadFile ( string $filename, string $type, string $title = null, string $introduction = null ) : array 新增永久素材 媒体文件类型别有图片(image)、语音(voice) 、视频(video)和缩略图(thumb)
uploadFileTemporary ( string $filename, string $type ) : array 上传临时素材文件
uploadNews ( string | array $title, string $thumb_media_id = null, string $author = null, string $digest = null, string $show_cover_pic = null, string $content = null, string $content_source_url = null ) : array 新增永久图文素材,所有参数全是必填,多图文素材一个参数传入数组即可,数组的key与本方法参数一致
uploadNewsImage ( $filename ) : string 上传图文消息内的图片获取URL (在图文消息的具体内容中,将过滤外部的图片链接),只能使用此方法返回的url 本接口所上传的图片不占用公众号的素材库中图片数量的5000个的限制。图片仅支持jpg/png格式,大小必须在1MB以下。

Method Details

uploadFile() public static method

新增永久素材 媒体文件类型别有图片(image)、语音(voice) 、视频(video)和缩略图(thumb)
public static uploadFile ( string $filename, string $type, string $title = null, string $introduction = null ) : array
$filename string
$type string
$title string 视频素材的标题 只对类型为video有效
$introduction string 视频素材的描述 只对类型为video有效
return array

uploadFileTemporary() public static method

curl -F [email protected] "http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=image"
public static uploadFileTemporary ( string $filename, string $type ) : array
$filename string 文件名
$type string 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb,主要用于视频与音乐格式的缩略图) 图片(image): 大小不超过2M,支持bmp/png/jpeg/jpg/gif格式 语音(voice):大小不超过5M,播放长度不超过60s,支持AMR\MP3格式 视频(video):10MB,支持MP4格式 缩略图(thumb):64KB,支持JPG格式
return array

uploadNews() public static method

新增永久图文素材,所有参数全是必填,多图文素材一个参数传入数组即可,数组的key与本方法参数一致
public static uploadNews ( string | array $title, string $thumb_media_id = null, string $author = null, string $digest = null, string $show_cover_pic = null, string $content = null, string $content_source_url = null ) : array
$title string | array
$thumb_media_id string
$author string
$digest string
$show_cover_pic string
$content string
$content_source_url string
return array

uploadNewsImage() public static method

上传图文消息内的图片获取URL (在图文消息的具体内容中,将过滤外部的图片链接),只能使用此方法返回的url 本接口所上传的图片不占用公众号的素材库中图片数量的5000个的限制。图片仅支持jpg/png格式,大小必须在1MB以下。
public static uploadNewsImage ( $filename ) : string
$filename
return string 例如 http://mmbiz.qpic.cn/mmbiz/D7sHwECXBUtWxg2eVOmIsqWOERic2dfBWYhWtOzIxhiaYAIt8ludGP0QHh8cO6pVQT8V8KKZcahvzQiblMWXlA4Pw/0