• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_file_get_contents函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_file_get_contents函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_file_get_contents函数的具体用法?PHP wp_file_get_contents怎么用?PHP wp_file_get_contents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wp_file_get_contents函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     if ($_REQUEST['doNotInit']) {
         return true;
     }
     $content = wp_file_get_contents('php://input');
     !empty($content) || die('这是微信请求的接口地址,直接在浏览器里无效');
     if ($_GET['encrypt_type'] == 'aes') {
         vendor('WXBiz.wxBizMsgCrypt');
         $this->sReqTimeStamp = I('get.timestamp');
         $this->sReqNonce = I('get.nonce');
         $this->sEncryptMsg = I('get.msg_signature');
         $map['id'] = I('get.id');
         $info = M('member_public')->where($map)->find();
         get_token($info['token']);
         // 设置token
         $this->wxcpt = new \WXBizMsgCrypt('weiphp', $info['encodingaeskey'], $info['appid']);
         $sMsg = "";
         // 解析之后的明文
         $errCode = $this->wxcpt->DecryptMsg($this->sEncryptMsg, $this->sReqTimeStamp, $this->sReqNonce, $content, $sMsg);
         if ($errCode != 0) {
             addWeixinLog($_GET, "DecryptMsg Error: " . $errCode);
             exit;
         } else {
             // 解密成功,sMsg即为xml格式的明文
             $content = $sMsg;
         }
     }
     $data = new \SimpleXMLElement($content);
     // $data || die ( '参数获取失败' );
     foreach ($data as $key => $value) {
         $this->data[$key] = strval($value);
     }
 }
开发者ID:Backflag,项目名称:weiphp2.0.1202,代码行数:34,代码来源:WeixinModel.class.php


示例2: uploadCert

 function uploadCert($fileId)
 {
     $managerId = $this->mid;
     $path = SITE_PATH . '\\Cert\\wxzf\\' . $managerId;
     $file = M('file')->find($fileId);
     $file['savepath'] = substr($file['savepath'], 0, strlen($file['savepath']) - 1);
     $filename = SITE_PATH . '\\Uploads\\Download\\' . $file['savepath'] . '\\' . $file['savename'];
     //         dump($file);
     //         dump($filename);
     //         dump(file_exists($filename));
     //         die;
     if (!file_exists($filename)) {
         $this->error('上传失败');
         exit;
     }
     // 	    $extend = $file ['ext'];
     // 	    if (! ($extend == 'pem' || $extend == 'p12' )) {
     // 	        $this->error('上传证书格式有误,扩展名应为 pem');
     // 	        exit();
     // 	    }
     $mkres = mkdirs($path);
     $content = wp_file_get_contents($filename);
     $res = file_put_contents($path . '\\' . $file['name'], $content);
     return $res;
 }
开发者ID:yxz1025,项目名称:weiphp3.0,代码行数:25,代码来源:PaymentController.class.php


示例3: _thumb_media_id

 function _thumb_media_id($cover_id)
 {
     $cover = get_cover($cover_id);
     $driver = C('PICTURE_UPLOAD_DRIVER');
     if ($driver != 'Local' && !file_exists(SITE_PATH . $cover['path'])) {
         // 先把图片下载到本地
         $pathinfo = pathinfo(SITE_PATH . $cover['path']);
         mkdirs($pathinfo['dirname']);
         $content = wp_file_get_contents($cover['url']);
         $res = file_put_contents(SITE_PATH . $cover['path'], $content);
         if ($res) {
             return '';
         }
     }
     $path = $cover['path'];
     if (!$path) {
         return '';
     }
     $param['type'] = 'thumb';
     $param['media'] = '@' . realpath(SITE_PATH . $path);
     $url = 'https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=' . get_access_token();
     $res = post_data($url, $param, true);
     if (isset($res['errcode']) && $res['errcode'] != 0) {
         return '';
     }
     $map['cover_id'] = $cover_id;
     $map['manager_id'] = $this->mid;
     $this->where($map)->setField('thumb_media_id', $res['media_id']);
     return $res['media_id'];
 }
开发者ID:walkingmanc,项目名称:weshop,代码行数:30,代码来源:MaterialModel.class.php


示例4: getRemoteVersion

 function getRemoteVersion()
 {
     // cookie ( 'cookie_close_version', 0 );
     $remote = 'http://www.weiphp.cn/index.php?s=/home/index/update_version';
     $new_version = wp_file_get_contents($remote);
     $res = $new_version > C('SYSTEM_UPDATRE_VERSION') && cookie('cookie_close_version') != $new_version;
     echo $res ? $new_version : 0;
 }
开发者ID:pondyond,项目名称:WeiPHP,代码行数:8,代码来源:UpdateController.class.php


示例5: get_content_by_url_id

 private function get_content_by_url_id($id)
 {
     $url = "http://job.snnu.edu.cn/com/show_info.asp?com_id={$id}&com_version=0&action=com_info";
     $source = wp_file_get_contents($url);
     $s = mb_convert_encoding($source, "UTF-8", "GB18030");
     preg_match_all("/<div id=attitle>([^>]+)<\\/div>/i", $s, $_title);
     //        preg_match_all("/<div id=dwinfor align=\"center\">([^\n]+).*/i", $s, $_subContent);
     //        preg_match_all("/<FONT style=([^\n]+).*/i", $s, $_mainContent);
     $title = trim($_title[1][0]);
     //        $content = $_subContent[0][0].$_mainContent[0][0];
     return array("title" => $title, "url" => $url);
 }
开发者ID:amotewangrong,项目名称:WeiPHP-SWXZS,代码行数:12,代码来源:ZpxxController.class.php


示例6: __construct

 public function __construct()
 {
     if ($_REQUEST['doNotInit']) {
         return true;
     }
     $content = wp_file_get_contents('php://input');
     !empty($content) || die('这是微信请求的接口地址,直接在浏览器里无效');
     if ($_GET['encrypt_type'] == 'aes') {
         vendor('WXBiz.wxBizMsgCrypt');
         $this->sReqTimeStamp = I('get.timestamp');
         $this->sReqNonce = I('get.nonce');
         $this->sEncryptMsg = I('get.msg_signature');
         if (isset($_GET['appid'])) {
             // if ($_GET ['appid'] == 'wx570bc396a51b8ff8') {
             // 	$info ['token'] = 'gh_3c884a361561';
             // 	$info ['encodingaeskey'] = 'DfEqNBRvzbg8MJdRQCSGyaMp6iLcGOldKFT0r8I6Tnp';
             // 	$info ['appid'] = 'wxea0485bef5247236';
             // } else {
             // 	$map ['appid'] = I ( 'get.appid' );
             // 	$info = D ( 'Common/Public' )->where ( $map )->find ();
             // }
             $map['appid'] = I('get.appid');
             $info = D('Common/Public')->where($map)->find();
         } else {
             $id = I('get.id');
             $info = D('Common/Public')->getInfo($id);
         }
         get_token($info['token']);
         // 设置token
         $this->wxcpt = new \WXBizMsgCrypt($info['mp_token'], $info['encodingaeskey'], $info['appid']);
         $sMsg = "";
         // 解析之后的明文
         $errCode = $this->wxcpt->DecryptMsg($this->sEncryptMsg, $this->sReqTimeStamp, $this->sReqNonce, $content, $sMsg);
         if ($errCode != 0) {
             addWeixinLog($_GET, "DecryptMsg Error: " . $errCode);
             addWeixinLog($content, "DecryptMsg Error: content");
             exit;
         } else {
             // 解密成功,sMsg即为xml格式的明文
             $content = $sMsg;
         }
     }
     $data = new \SimpleXMLElement($content);
     // $data || die ( '参数获取失败' );
     foreach ($data as $key => $value) {
         $this->data[$key] = safe(strval($value));
     }
 }
开发者ID:LukeChow1018,项目名称:weixin,代码行数:48,代码来源:WeixinModel.class.php


示例7: __construct

 public function __construct()
 {
     if ($_REQUEST['doNotInit']) {
         return true;
     }
     $content = wp_file_get_contents('php://input');
     !empty($content) || die('这是微信请求的接口地址,直接在浏览器里无效');
     if ($_GET['encrypt_type'] == 'aes') {
         vendor('WXBiz.wxBizMsgCrypt');
         $this->sReqTimeStamp = I('get.timestamp');
         $this->sReqNonce = I('get.nonce');
         $this->sEncryptMsg = I('get.msg_signature');
         if (isset($_GET['appid'])) {
             $map['appid'] = I('get.appid');
             $info = D('Common/Public')->where($map)->find();
         } else {
             $id = I('get.pid');
             $info = D('Common/Public')->getInfo($id);
         }
         $info['encodingaeskey'] = 'Wry3C6IG6yzFR55cnje0W7CWd2jqlqQrAIK5ilOIfo3';
         $info['appid'] = D('Addons://PublicBind/PublicBind')->component_appid;
         get_token($info['token']);
         // 设置token
         $this->wxcpt = new \WXBizMsgCrypt('youkang120', $info['encodingaeskey'], $info['appid']);
         $sMsg = "";
         // 解析之后的明文
         $errCode = $this->wxcpt->DecryptMsg($this->sEncryptMsg, $this->sReqTimeStamp, $this->sReqNonce, $content, $sMsg);
         if ($errCode != 0) {
             addWeixinLog($_GET, "DecryptMsg Error: " . $errCode);
             addWeixinLog($content, "DecryptMsg Error: content");
             exit;
         } else {
             // 解密成功,sMsg即为xml格式的明文
             $content = $sMsg;
         }
     }
     $data = new \SimpleXMLElement($content);
     // $data || die ( '参数获取失败' );
     foreach ($data as $key => $value) {
         $this->data[$key] = safe(strval($value));
     }
 }
开发者ID:kevinstudio,项目名称:zaodianla,代码行数:42,代码来源:WeixinModel.class.php


示例8: tongbuyonghuhao

 public function tongbuyonghuhao()
 {
     //同步用户号
     $token = get_token();
     $access_token = get_access_token($token);
     $url = 'https://api.weixin.qq.com/cgi-bin/user/get?access_token=' . $access_token . '';
     $users = json_decode(wp_file_get_contents($url), true);
     if (!$users['total']) {
         $this->error("更新失败");
     }
     $data = $users['data'];
     $openidArray = $data['openid'];
     foreach ($openidArray as $key => $openid) {
         $userInfo = getWeixinUserInfo($openid, $token);
         $map['openid'] = $userInfo['openid'];
         $data['nickname'] = $userInfo['nickname'];
         $data['sex'] = $userInfo['sex'];
         $data['city'] = $userInfo['city'];
         $data['country'] = $userInfo['country'];
         $data['province'] = $userInfo['province'];
         $data['language'] = $userInfo['language'];
         $data['headimgurl'] = $userInfo['headimgurl'];
         $data['subscribe_time'] = $userInfo['subscribe_time'];
         $data['status'] = $userInfo['subscribe'];
         $data['token'] = $token;
         $result_id = M('Follow')->where($map)->getField('id');
         if ($result_id) {
             //更新
             $data['id'] = $result_id;
             M('Follow')->save($data);
             unset($data);
         } else {
             //新增
             D('Common/Follow')->init_follow($userInfo['openid']);
         }
     }
     $this->success("同步完成!");
 }
开发者ID:strivi,项目名称:siples,代码行数:38,代码来源:UserCenterController.class.php


示例9: getSendInfo

 function getSendInfo($id)
 {
     $info = $this->getInfo($id);
     $map['id'] = $info['shop_id'];
     $api_key = M('shop')->where($map)->getField('api_key');
     empty($api_key) && ($api_key = '02727dd96ccf4c4eabb091d85cb7fa10');
     $url = 'http://v.juhe.cn/exp/index?key=' . $api_key . '&com=' . $info['send_code'] . '&no=' . $info['send_number'];
     $data = wp_file_get_contents($url);
     $data = json_decode($data, true);
     if ($data['resultcode'] == 200) {
         $save['order_id'] = $id;
         $save['status_code'] = 3;
         $save['extend'] = 1;
         M('shop_order_log')->where($save)->delete();
         foreach ($data['result']['list'] as $vo) {
             $save['cTime'] = strtotime($vo['datetime']);
             $save['remark'] = $vo['zone'] . ' ' . $vo['remark'];
             M('shop_order_log')->add($save);
         }
     }
     return $data;
 }
开发者ID:SmartNMS,项目名称:weiphp3,代码行数:22,代码来源:OrderModel.class.php


示例10: _updateWechatGroup

 function _updateWechatGroup()
 {
     // 先取当前用户组数据
     $map['token'] = get_token();
     $map['manager_id'] = $this->mid;
     $map['type'] = 1;
     $group_list = M('auth_group')->where($map)->getField('wechat_group_id,id');
     $url = 'https://api.weixin.qq.com/cgi-bin/groups/get?access_token=' . get_access_token();
     $data = wp_file_get_contents($url);
     $data = json_decode($data, true);
     foreach ($data['groups'] as $d) {
         if (isset($group_list[$d['id']])) {
             continue;
         }
         $map['wechat_group_id'] = $d['id'];
         $map['wechat_group_name'] = $d['name'];
         $map['wechat_group_count'] = $d['count'];
         // 增加本地数据
         $map['title'] = $d['name'];
         $map['qr_code'] = '';
         M('auth_group')->add($save);
     }
 }
开发者ID:walkingmanc,项目名称:weshop,代码行数:23,代码来源:IndexController.class.php


示例11: syc_openid

 function syc_openid()
 {
     error_log('第一步:获取全部用户的ID,并先保存到public_follow表中,新的用户UID暂时为0,后面的步骤补充');
     // 获取openid列表
     $url = 'https://api.weixin.qq.com/cgi-bin/user/get?access_token=' . get_access_token() . '&next_openid=' . I('next_openid');
     $data = wp_file_get_contents($url);
     $data = json_decode($data, true);
     if (!isset($data['count']) || $data['count'] == 0) {
         // 拉取完毕
         $this->success('同步用户数据中,请勿关闭', U('syc_user'));
         exit;
     }
     $map['openid'] = array('in', $data['data']['openid']);
     $map['token'] = $save['token'] = get_token();
     $res = M('public_follow')->where($map)->setField('syc_status', 0);
     if ($res != $data['count']) {
         // 更新的数量不一致,可能有增加的用户openid
         $openids = (array) M('public_follow')->where($map)->getFields('openid');
         $diff = array_diff($data['data']['openid'], $openids);
         if (!empty($diff)) {
             foreach ($diff as $id) {
                 $save['openid'] = $id;
                 $save['uid'] = 0;
                 $save['syc_status'] = 0;
                 $res = M('public_follow')->add($save);
             }
         }
     }
     $param2['next_openid'] = $data['next_openid'];
     $url = U('syc_openid', $param2);
     $this->success('同步用户OpenID中,请勿关闭', $url);
 }
开发者ID:kevinstudio,项目名称:zaodianla,代码行数:32,代码来源:UserCenterController.class.php


示例12: updateWechatGroup

 function updateWechatGroup()
 {
     error_log('与微信的用户组保持同步');
     // 先取当前用户组数据
     $map['token'] = get_token();
     $map['manager_id'] = $this->mid;
     $map['type'] = 1;
     $group_list = M('auth_group')->where($map)->field('id,title,wechat_group_id,wechat_group_name,wechat_group_count')->select();
     foreach ($group_list as $g) {
         $groups[$g['wechat_group_id']] = $g;
     }
     $url = 'https://api.weixin.qq.com/cgi-bin/groups/get?access_token=' . get_access_token();
     $data = wp_file_get_contents($url);
     $data = json_decode($data, true);
     if (!isset($data['errcode'])) {
         foreach ($data['groups'] as $d) {
             $save['wechat_group_id'] = $map['wechat_group_id'] = $d['id'];
             $save['wechat_group_name'] = $d['name'];
             $save['wechat_group_count'] = $d['count'];
             if (isset($groups[$d['id']])) {
                 // 更新本地数据
                 $old = $groups[$d['id']];
                 if ($old['title'] != $d['name']) {
                     $old['wechat_group_name'] = $old['title'];
                     $save['wechat_group_name'] = $old['title'];
                     //修改微信端的数据
                     $updateUrl = "https://api.weixin.qq.com/cgi-bin/groups/update?access_token=" . get_access_token();
                     $newGroup['group']['id'] = $d['id'];
                     $newGroup['group']['name'] = $save['wechat_group_name'];
                     $res = post_data($updateUrl, $newGroup);
                 }
                 if ($old['wechat_group_name'] != $d['name'] || $old['wechat_group_count'] != $d['count']) {
                     // 					$save['title']=$save['wechat_group_name'];
                     M('auth_group')->where($map)->save($save);
                 }
                 unset($groups[$d['id']]);
             } else {
                 // 增加本地数据
                 $save = array_merge($save, $map);
                 $save['title'] = $d['name'];
                 $save['qr_code'] = '';
                 M('auth_group')->add($save);
             }
         }
         foreach ($groups as $v) {
             $map2['id'] = $map3['group_id'] = $v['id'];
             $wechat_group_id = intval($v['wechat_group_id']);
             if ($wechat_group_id == -1) {
                 // 增加微信端的数据
                 $url = 'https://api.weixin.qq.com/cgi-bin/groups/create?access_token=' . get_access_token();
                 $param['group']['name'] = $v['title'];
                 $param = JSON($param);
                 $res = post_data($url, $param);
                 if (!empty($res['group']['id'])) {
                     $info['wechat_group_id'] = $save['wechat_group_id'] = $res['group']['id'];
                     $save['wechat_group_name'] = $res['group']['name'];
                     M('auth_group')->where($map2)->save($save);
                 }
             } else {
                 // 删除本地数据
                 M('auth_group')->where($map2)->delete();
                 M('auth_group_access')->where($map3)->delete();
             }
         }
     }
     if (isset($_GET['need_return'])) {
         redirect(addons_url('UserCenter://UserCenter/syc_openid'));
     }
 }
开发者ID:kevinstudio,项目名称:zaodianla,代码行数:69,代码来源:AuthGroupController.class.php


示例13: init

 /**
  * 初始化微信推送的数据
  */
 private function init()
 {
     $xml = wp_file_get_contents("php://input");
     $data = self::xml2data($xml);
     //安全模式 或兼容模式
     if (self::$msgSafeMode) {
         if (isset($data['MsgType'])) {
             //兼容模式追加解密后的消息内容
             $data['Decrypt'] = self::extract($data['Encrypt']);
         } else {
             //安全模式
             $data = self::extract($data['Encrypt']);
         }
     }
     $this->data = $data;
 }
开发者ID:393197906,项目名称:hummingbird,代码行数:19,代码来源:Wechat.class.php


示例14: _footer

 function _footer($temp_type = 'weiphp')
 {
     if ($temp_type == 'pigcms') {
         $param['token'] = $token = get_token();
         $param['temp'] = $this->config['template_footer'];
         $url = U('Home/Index/getFooterHtml', $param);
         $html = wp_file_get_contents($url);
         // dump ( $url );
         // dump ( $html );
         $file = RUNTIME_PATH . $token . '_' . $this->config['template_footer'] . '.html';
         if (!file_exists($file) || true) {
             file_put_contents($file, $html);
         }
         $this->assign('cateMenuFileName', $file);
     } else {
         $list = D('Addons://WeiSite/Footer')->get_list();
         foreach ($list as $k => $vo) {
             if ($vo['pid'] != 0) {
                 continue;
             }
             $one_arr[$vo['id']] = $vo;
             unset($list[$k]);
         }
         foreach ($one_arr as &$p) {
             $two_arr = array();
             foreach ($list as $key => $l) {
                 if ($l['pid'] != $p['id']) {
                     continue;
                 }
                 $two_arr[] = $l;
                 unset($list[$key]);
             }
             $p['child'] = $two_arr;
         }
         $this->assign('footer', $one_arr);
         $html = $this->fetch(ONETHINK_ADDON_PATH . 'WeiSite/View/default/TemplateFooter/' . $this->config['template_footer'] . '/footer.html');
         $this->assign('footer_html', $html);
     }
 }
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:39,代码来源:WeiSiteController.class.php


示例15: init_follow

 private function init_follow($data)
 {
     $info = get_token_appinfo($data['ToUserName']);
     $config = S('PUBLIC_AUTH_' . $info['type']);
     if (!$config) {
         $config = M('public_auth')->getField('name,type_' . $info['type'] . ' as val');
         S('PUBLIC_AUTH_' . $info['type'], $config, 86400);
     }
     C($config);
     // 公众号接口权限
     // 初始化用户信息
     $map['token'] = $data['ToUserName'];
     $map['openid'] = $data['FromUserName'];
     $GLOBALS['mid'] = $uid = M('public_follow')->where($map)->getField('uid');
     // 绑定配置
     $config = getAddonConfig('UserCenter', $map['token']);
     if (!$uid && C('USER_BASE_INFO')) {
         // 如果有权限获取用户信息,即自动获取
         $url = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=' . get_access_token() . '&openid=' . $data['FromUserName'] . '&lang=zh_CN';
         $userInfo = wp_file_get_contents($url);
         $userInfo = json_decode($userInfo, true);
         if (isset($userInfo['nickname'])) {
             // 自动注册
             $user = array('experience' => intval($config['experience']), 'score' => intval($config['score']), 'reg_ip' => get_client_ip(1), 'reg_time' => NOW_TIME, 'last_login_ip' => get_client_ip(1), 'last_login_time' => NOW_TIME, 'status' => 1, 'is_init' => 1, 'is_audit' => 1);
             $user = array_merge($user, $userInfo);
             $map['uid'] = $uid = D('Common/User')->add($user);
             $res = M('public_follow')->add($map);
         }
     }
     $guestAccess = strtolower(CONTROLLER_NAME) != 'weixin';
     $userNeed = $user['uid'] > 0 && $user['status'] < 2 || empty($user) && $guestAccess;
     if ($config['need_bind'] == 1 && $userNeed && C('USER_OAUTH')) {
         unset($map['uid']);
         $bind_url = addons_url('UserCenter://Wap/bind', $map);
         if ($config['bind_start'] != 0 && strtolower($data['Event']) != 'subscribe') {
             $dao->replyText('请先<a href="' . $bind_url . '">绑定账号</a>再使用');
             exit;
         }
     }
 }
开发者ID:chenpusn,项目名称:guoxian,代码行数:40,代码来源:WeixinController.class.php


示例16: GroupsQuery

 public function GroupsQuery()
 {
     $access_token = $this->accessToken;
     $url = 'https://api.weixin.qq.com/cgi-bin/groups/get?access_token=' . $access_token;
     $tempArr = json_decode(wp_file_get_contents($url), true);
     if (@array_key_exists('groups', $tempArr)) {
         return $tempArr['groups'];
         // 返回数组格式的分组信息
     } else {
         $this->ErrorLogger('groups query falied.');
         $this->AccessTokenGet();
         $this->GroupsQuery();
     }
 }
开发者ID:walkingmanc,项目名称:weshop,代码行数:14,代码来源:QrCodeModel.class.php


示例17: execute_sql_file

/**
 * 执行SQL文件
 */
function execute_sql_file($sql_path)
{
    // 读取SQL文件
    $sql = wp_file_get_contents($sql_path);
    $sql = str_replace("\r", "\n", $sql);
    $sql = explode(";\n", $sql);
    // 替换表前缀
    $orginal = 'wp_';
    $prefix = C('DB_PREFIX');
    $sql = str_replace("{$orginal}", "{$prefix}", $sql);
    // 开始安装
    foreach ($sql as $value) {
        $value = trim($value);
        if (empty($value)) {
            continue;
        }
        $res = M()->execute($value);
        // dump($res);
        // dump(M()->getLastSql());
    }
}
开发者ID:amotewangrong,项目名称:WeiPHP-SWXZS,代码行数:24,代码来源:function.php


示例18: get_image_media_id

 function get_image_media_id($cover_id)
 {
     $cover = get_cover($cover_id);
     $driver = C('PICTURE_UPLOAD_DRIVER');
     if ($driver != 'Local' && !file_exists(SITE_PATH . $cover['path'])) {
         // 先把图片下载到本地
         $pathinfo = pathinfo(SITE_PATH . $cover['path']);
         mkdirs($pathinfo['dirname']);
         $content = wp_file_get_contents($cover['url']);
         $res = file_put_contents(SITE_PATH . $cover['path'], $content);
         if (!$res) {
             return 0;
         }
     }
     $path = $cover['path'];
     if (!$path) {
         return 0;
     }
     $param['type'] = 'image';
     $param['media'] = '@' . realpath(SITE_PATH . $path);
     $url = 'https://api.weixin.qq.com/cgi-bin/media/upload?access_token=' . get_access_token();
     $res = post_data($url, $param, true);
     if (isset($res['errcode']) && $res['errcode'] != 0) {
         return 0;
     }
     return $res['media_id'];
 }
开发者ID:chenpusn,项目名称:haozhixian_bak,代码行数:27,代码来源:CustomModel.class.php


示例19: get_wx_user_info

/**
 * 通过openid获取用户基本信息
 */
function get_wx_user_info($openid = null, $lang = 'zh_CN')
{
    $access_token = get_access_token();
    !empty($openid) || ($openid = get_openid());
    $url = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=' . $access_token . '&openid=' . $openid . '&lang=' . $lang;
    return json_decode(wp_file_get_contents($url), true);
}
开发者ID:PunkAvail,项目名称:ThinkWechat,代码行数:10,代码来源:function.php


示例20: downloadAndInstall

 /**
  * 本地一键安装接口
  *
  * @return void
  */
 public function downloadAndInstall()
 {
     header("content-Type: text/html; charset=utf-8");
     // 获取下载地址
     $id = intval($_GET['id']);
     $url = $this->remoteBaseURL . '/index.php?s=admin/store/downloadApp&id=' . $id;
     // 		dump($url);exit;
     $info = wp_file_get_contents($url);
     $info = json_decode($info, true);
     if (!$info['status']) {
         $this->error($info['error']);
         exit;
     }
     // 载入下载类
     Vendor('Update');
     $updateClass = new \Update();
     // 从服务器端下载应用到本地
     $res = $updateClass->downloadFile($info['data']['packageURL']);
     if ($res != 1) {
         $this->error('下载应用失败,请确认网络是否正常');
         exit;
     }
     // 压缩
     $package = explode('/', $info['data']['packageURL']);
     $packageName = array_pop($package);
     $targetDir = $updateClass->downloadPath . 'unzip';
     // 创建目录unzip
     if (!is_dir($targetDir)) {
         @mkdir($targetDir, 0777);
     }
     $res = $updateClass->unzipPackage($packageName, $targetDir);
     if ($res != 1) {
         $this->error('下载应用解压失败');
         exit;
     }
     // 覆盖代码
     switch ($info['data']['type']) {
         case 3:
             // 万能页面功能块
             $res = $updateClass->overWrittenFile(SITE_PATH . '/Addons/Diy/Widget');
             break;
         case 2:
             // 在线素材
             $res = $updateClass->overWrittenFile(SITE_PATH . '/Addons/Material');
             break;
         case 2:
             // 微官网模板
             $res = $updateClass->overWrittenFile(SITE_PATH . '/Addons/WeiSite/View/default');
             break;
         default:
             // 微信插件
             $res = $updateClass->overWrittenFile(SITE_PATH . '/Addons');
             if (empty($res)) {
                 $this->install($updateClass->addon_name);
                 exit;
             }
     }
     $this->success('安装完成');
 }
开发者ID:noikiy,项目名称:weiphp,代码行数:64,代码来源:UpdateController.class.php



注:本文中的wp_file_get_contents函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_filter_comment函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_extract_urls函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap