扫微信二维码广告语Word格式.docx

上传人:b****3 文档编号:16795223 上传时间:2022-11-26 格式:DOCX 页数:5 大小:16.57KB
下载 相关 举报
扫微信二维码广告语Word格式.docx_第1页
第1页 / 共5页
扫微信二维码广告语Word格式.docx_第2页
第2页 / 共5页
扫微信二维码广告语Word格式.docx_第3页
第3页 / 共5页
扫微信二维码广告语Word格式.docx_第4页
第4页 / 共5页
扫微信二维码广告语Word格式.docx_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

扫微信二维码广告语Word格式.docx

《扫微信二维码广告语Word格式.docx》由会员分享,可在线阅读,更多相关《扫微信二维码广告语Word格式.docx(5页珍藏版)》请在冰豆网上搜索。

扫微信二维码广告语Word格式.docx

  publicfunction__construct($options)    {

  $this->

_account=isset($options)?

$options:

;

        $this->

_datapath=

  isset($options)?

$this->

_datapath;

debug=isset($options)?

false;

_logcallback=

_cookiename=$this->

_datapath.$this->

_account;

getCookie($this->

_cookiename);

    }    /**

  *把cookie写入缓存

  *@paramstring$filename缓存文件名    *@paramstring$content文件内容    *@returnbool    */

  publicfunctionsaveCookie($filename,$content){        returnfile_put_contents($filename,$content);

  *读取cookie缓存内容

  *@paramstring$filename缓存文件名    *@returnstringcookie    */

  publicfunctiongetCookie($filename){        if(file_exists($filename)){

  $mtime=filemtime($filename);

  if($mtime_cookieexpired)returnfalse;

            $data=file_get_contents($filename);

            if($data)$this->

cookie=$data;

        }

  return$this->

cookie;

    }

  /*

  *删除cookie    */

  publicfunctiondeleteCookie($filename){        $this->

cookie=;

        @unlink($filename);

        returntrue;

  privatefunctionlog($log){

  if($this->

debug&

&

function_exists($this->

_logcallback)){            if(is_array($log))$log=print_r($log,true);

            returncall_user_func($this->

_logcallback,$log);

  }

  /**

  *获取登陆二维码对应的授权码    */

  publicfunctionget_login_code(){

_logincode)return$this->

_logincode;

        $t=time().strval(mt_rand(100,999));

        $codeurl=

  https:

///jslogin?

appid=wx782c26e4c19acffb&

redirect_uri=https%3A%2F%%2Fcgi-bin%2Fmmwebwx-bin%2Fwebwxnewloginpage&

fun=new&

lang=zh_CN&

_=.$t;

        $send_snoopy=newSnoopy;

        $send_snoopy->

fetch($codeurl);

        $result=$send_snoopy->

results;

        if($result){

  preg_match(

_logincode=$matches;

                $_SESSION=0;

                return$this->

            }        }

  return$result;

  *通过授权码获取对应的二维码图片地址    *@paramstring$code    *@returnstringimageurl    */

  publicfunctionget_code_image($code=){

  if($code==)$code=$this->

        if(!

$code)returnfalse;

  returnhttp:

///qrcode/.$this->

_logincode.?

t=webwx;

  *设置二维码对应的授权码    *@paramstring$code    *@returnclass$this    */

  publicfunctionset_login_code($code){        $this->

_logincode=$code;

        return$this;

  *二维码登陆验证    *

  *@returnstatus:

  *>

=400:

invaildcode;

408:

notauthandwait,400,401:

notvalidorexpired    *201:

justscanedbutnotconfirm    *200:

confirmthenyoucangetuserinfo    */

  publicfunctionverify_code(){

  if(!

_logincode)returnfalse;

            $url=

///cgi-bin/mmwebwx-bin/login?

uuid=.$this->

_logincode.&

tip=1&

  $send_snoopy=newSnoopy;

  $send_snoopy->

referer=

  $status=intval($matches);

  if($status==201)$_SESSION=1;

                    if($status==200){

log(step2:

.print_r($matches,true));

                        if(count($matches)>

1){                            $ticket=$matches;

                            $scan=$matches;

                            $loginurl=

///cgi-bin/mmwebwx-bin/webwxnewloginpage?

ticket=.$ticket.&

scan=.$scan.&

fun=new;

                            $send_snoopy->

referer=

fetch($loginurl);

                            $this->

log(step3:

.print_r($send_snoopy->

headers,true));

  foreach($send_snoopy->

headersas$key=>

$value){

  $value=trim($value);

                                if(strpos($value,Set-Cookie:

)!

==false){

  $tmp=str_replace(

  $cookie.=$tmp;

                                }                            }

  $cookie.=

  return$status;

                }            }        returnfalse;

  *获取登陆的cookie    *

  *@parambool$is_array是否以数值方式返回,默认否,返回字符串    *@returnstring|array    */

  publicfunctionget_login_cookie($is_array=false){        if(!

$is_array)    return$this->

        $c_arr=explode(;

$this->

cookie);

        $cookie=array();

  foreach($c_arras$item){

  $kitem=explode(=,trim($item));

            if(count($kitem)>

1){

  $key=trim($kitem);

                $val=trim($kitem);

empty($val))$cookie=$val;

  return$cookie;

  *    授权登陆后获取用户登陆信息    */

  publicfunctionget_login_info(){

cookie)returnfalse;

  $submit=https:

///cgi-bin/mmwebwx-bin/webwxinit?

r=.$t;

rawheaders=$this->

log(login_info:

.$send_snoopy->

results);

results,true);

        if($result_login_user=$result;

        return$result;

  *获取头像

  *@paramstring$url传入从用户信息接口获取到的头像地址    */

  publicfunctionget_avatar($url){        if(!

        if(strpos($url,http)===false){            $url=http:

//$url;

  $result=$send_snoopy->

        if($result)

        else

  returnfalse;

  *登出当前登陆用户    */

  publicfunctionlogout(){

///cgi-bin/mmwebwx-bin/webwxlogout?

redirect=1&

type=1;

submit($submit,array(uin=>

$uid,sid=>

$sid));

deleteCookie($this->

    }}

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 农林牧渔 > 畜牧兽医

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1