添加小程序卡片素材

$obj = new \wechat\Wechat();
// false.失败 true.成功
$obj->official()->material()->mini_create('{
  "type": 0,
  "media_id": "xxxxxxxx",
  "title": "xxxxx",
  "path": "xxxxxxxx",
  "appid":"xxxxxx"
}');

查询小程序卡片素材

$obj = new \wechat\Wechat();
$obj->official()->material()->mini_get([
	"type" => 0
]);

成功结果:

array(1) {
  [0]=>
  array(6) {
    ["title"]=>
    string(5) "title"
    ["appid"]=>
    string(6) "xxxxxx"
    ["path"]=>
    string(10) "path111111"
    ["picurl"]=>
    string(7) "xxxxxxx"
    ["master_id"]=>
    string(6) "xxxxxx"
    ["slave_id"]=>
    string(6) "xxxxxx"
  }
}

删除小程序卡片素材

$obj = new \wechat\Wechat();
// false.失败 true.成功
$obj->official()->material()->mini_delete('{
    "type": 0,
    "title": "xxxxx",
    "path": "xxxxxxxx",
    "appid":"xxxxxx"
}');

添加图片素材

$obj = new \wechat\Wechat();
// false.失败 true.成功
$obj->official()->material()->image_create('{
    "type": 0,
    "media_id": "xxxxxxxx"
}');

查询图片素材

$obj = new \wechat\Wechat();
$obj->official()->material()->image_get([
    "type" => 0,
    "start" => 0,
    "num" => 10
]);

成功结果:

array(2) {
  ["model_list"]=>
  array(1) {
    [0]=>
    array(1) {
      ["picurl"]=>
      string(6) "xxxxxx"
    }
  }
  ["total_num"]=>
  int(1)
}

删除图片素材

$obj = new \wechat\Wechat();
// false.失败 true.成功
$obj->official()->material()->image_delete('{
    "type": 0,
    "picurl": "xxxx"
}');

添加文字素材

$obj = new \wechat\Wechat();
// false.失败 true.成功
$obj->official()->material()->text_create('{
    "type": 0,
    "word": "hello world"
}');

查询文字素材

$obj = new \wechat\Wechat();
$obj->official()->material()->text_get([
    "type" => 0,
    "start" => 0,
    "num" => 10
]);

成功结果:

array(2) {
  ["word_list"]=>
  array(1) {
    [0]=>
    array(2) {
      ["word"]=>
      string(12) "hello world!"
      ["create_time"]=>
      int(1574653070)
    }
  }
  ["total_num"]=>
  int(1)
}

删除文字素材

$obj = new \wechat\Wechat();
// false.失败 true.成功
$obj->official()->material()->text_delete('{
    "type": 0,
    "word": "hello world"
}');

SW-X

企业级 - 高性能 PHP 框架

最后更新:3年前 . 作者-小黄牛

本篇目录