引入文件
文件下載地址:
http://pan.baidu.com/s/1eSiVDeU
use Com\Wechat\WechatAuth;
public function shangchuan(){
die();
$appid = C ( "WX_APPID" );
$appsecret = C ( "WX_CRYPT" );
$token = S ( "token" );
if ($token) {
$auth = new WechatAuth ( $appid, $appsecret, $token );
} else {
$auth = new WechatAuth ( $appid, $appsecret );
$token = $auth->getAccessToken ();
S ( "token", $token ['access_token'], array (
'expire' => $token ['expires_in']
) );
}
$filename='./Upload/youshi.jpg'; //此地址為你要上傳的圖片的路徑
$type='image';
$res=$auth->materialAddMaterial($filename, $type);
dump($res);
}