作者 王晓刚
1 个管道 的构建 通过 耗费 0 秒

上传图片

... ... @@ -234,12 +234,15 @@ class SalesmangoodsController extends WeChatBaseController{
* 上传图片
*/
public function savePicture(){
$access_token=$this->getAccessToken();
$options = config('wechat_config');
$app = new Application($options);
$accessToken = $app->access_token;
$access_token = $accessToken->getToken();
// $access_token=$this->getAccessToken();
$filepath = $_POST['mediaId'];
$str = 'uploads/'.date('YmdHis').time().rand('1000000','99999999').'.png';
$targetName = $str;
$access_token = $access_token['accessToken'];
// $access_token = $access_token['accessToken'];
$url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=$access_token&media_id=$filepath";
// $file = file_get_contents("http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=$access_token&media_id=$filepath");
$file = $this->httpGet($url);
... ...