本文整理汇总了PHP中utils::encrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP utils::encrypt方法的具体用法?PHP utils::encrypt怎么用?PHP utils::encrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils
的用法示例。
在下文中一共展示了utils::encrypt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index($enc_str)
{
$app_define = utils::decrypt($enc_str);
$action_url = urldecode($action_url);
$obj_wstage = vmc::singleton('wechat_stage');
$access_token = $obj_wstage->get_access_token(false, $app_define);
$app_id = $app_define['app_id'];
vmc::singleton('base_session')->start();
$session_str = utils::encrypt(array('session_id' => vmc::singleton('base_session')->sess_id() . '|' . time()));
$session_str = app::get('mobile')->router()->encode_args($session_str);
$redirect_uri = vmc::openapi_url('openapi.toauth', 'callback', array('wechat_toauth_pam' => 'callback')) . '?qrlp=' . $session_str;
$forward = $_GET['forward'];
$state = app::get('mobile')->router()->gen_url(array('app' => 'wechat', 'ctl' => 'mobile_wxqrlogin', 'act' => 'dologin'));
$long_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$app_id}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_userinfo&state={$state}#wechat_redirect";
if (!$access_token) {
$this->splash('error', '', '二维码生成失败');
}
if ($surl = $obj_wstage->gen_surl($long_url, $access_token, $msg)) {
$this->pagedata['surl'] = $surl;
} else {
$this->splash('error', '', '二维码生成失败:' . $msg);
}
// if($this->_reqeust->is_ajax()){
// $qrcode = vmc::singleton('wechat_qrcode')->create($surl);
// $qrcode_url = base_storager::inmage_path($qrcode['image_id']);
// $this->splash('success','',array('qrcode_url'=>$qrcode_url));
// }
$this->pagedata['forward'] = $forward;
$this->page('site/loginqrcode.html');
}
示例2: preview
public function preview($theme, $theme_root_dir_cookie)
{
$theme_preview_cookie = utils::encrypt($theme);
setcookie('CURRENT_THEME_M', $theme_preview_cookie);
$_COOKIE['CURRENT_THEME_M'] = $theme_preview_cookie;
if ($theme_root_dir) {
$theme_root_dir_cookie = utils::encrypt($theme_root_dir);
setcookie('THEME_M_DIR', $theme_root_dir_cookie);
$_COOKIE['THEME_M_DIR'] = $theme_root_dir_cookie;
}
$this->redirect(array('app' => 'mobile', 'ctl' => 'index'));
}
示例3: authorize_url
public function authorize_url()
{
$app_id = $this->getConf('app_id', __CLASS__);
$app_secret = $this->getConf('app_secret', __CLASS__);
$redirect_uri = $this->callback_url;
//state=STATE 在前台会被跟踪替换成state=$forward;
$url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$app_id}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
//微信里
if (base_mobiledetect::is_wechat()) {
return $url;
}
//手机中,微信外
if (base_mobiledetect::is_mobile()) {
return false;
}
//适合扫码登录
return app::get('site')->router()->gen_url(array('app' => 'wechat', 'ctl' => 'site_wxqrlogin', 'act' => 'index', 'args' => array(utils::encrypt(array('app_id' => $app_id, 'app_secret' => $app_secret)))));
}