本文整理匯總了PHP中es_session::is_set方法的典型用法代碼示例。如果您正苦於以下問題:PHP es_session::is_set方法的具體用法?PHP es_session::is_set怎麽用?PHP es_session::is_set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類es_session
的用法示例。
在下文中一共展示了es_session::is_set方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct()
{
$this->error = new ErrorCase();
//-------讀取配置文件
$incFileContents = file_get_contents(APP_ROOT_PATH . "public/qqv2_inc.php");
$this->inc = json_decode($incFileContents);
if (empty($this->inc)) {
$this->error->showError("20001");
}
if (!es_session::is_set('QC_userData')) {
self::$data = array();
} else {
self::$data = es_session::get('QC_userData');
}
}
示例2: Header
//微信v3版跳轉
//print_r($data['is_wap_url']); echo "<br>";echo $data['wap_notify_url'];exit;
if ($data['wap_notify_url'] && $data['is_wap_url'] == 1) {
Header("location:" . $data['wap_notify_url']);
exit;
}
//在支付界麵時,清空購買車,但如果清空了,用戶點:返回 後,再去購買時,會購買空商品,這個需要注意處理一下
$session_cart_data = es_session::get("cart_data");
unset($session_cart_data);
es_session::set("cart_data", $session_cart_data);
es_session::set("cart_data", array());
es_session::delete("cart_data");
}
if ($class == 'index') {
//已經執行過定位時,首頁不再做定位操作
if (es_session::is_set('m_latitude')) {
$GLOBALS['tmpl']->assign('has_location', 1);
} else {
$GLOBALS['tmpl']->assign('has_location', 0);
}
}
//echo $tmpl_dir; exit;
//print_r($request_param);exit;
$GLOBALS['tmpl']->assign('request', $request_param);
$GLOBALS['tmpl']->assign('is_ajax', intval($request_param['is_ajax']));
$GLOBALS['tmpl']->assign('data', $data);
$GLOBALS['tmpl']->assign('APP_ROOT', APP_ROOT);
$GLOBALS['tmpl']->assign("PC_URL", get_domain() . str_replace('/wap', "", APP_ROOT));
if (es_session::get('user_info')) {
$GLOBALS['tmpl']->assign('is_login', 1);
//用戶已登陸
示例3: api
/**
* 發起一個騰訊API請求
* @param $command 接口名稱 如:t/add
* @param $params 接口參數 array('content'=>'test');
* @param $method 請求方式 POST|GET
* @param $multi 圖片信息
* @return string
*/
public static function api($command, $params = array(), $method = 'GET', $multi = false)
{
if (es_session::is_set("t_access_token")) {
//OAuth 2.0 方式
//鑒權參數
$params['access_token'] = es_session::get("t_access_token");
$params['oauth_consumer_key'] = OAuth::$client_id;
$params['openid'] = es_session::get("t_openid");
$params['oauth_version'] = '2.a';
$params['clientip'] = Common::getClientIp();
$params['scope'] = 'all';
$params['appfrom'] = 'php-sdk2.0beta';
$params['seqid'] = time();
$params['serverip'] = $_SERVER['SERVER_ADDR'];
$url = self::$apiUrlHttps . trim($command, '/');
} elseif (es_session::is_set("t_openid") && es_session::is_set("t_openkey")) {
//openid & openkey方式
$params['appid'] = OAuth::$client_id;
$params['openid'] = es_session::get("t_openid");
$params['openkey'] = es_session::get("t_openkey");
$params['clientip'] = Common::getClientIp();
$params['reqtime'] = time();
$params['wbversion'] = '1';
$params['pf'] = 'php-sdk2.0beta';
$url = self::$apiUrlHttp . trim($command, '/');
//生成簽名
$urls = @parse_url($url);
$sig = SnsSign::makeSig($method, $urls['path'], $params, OAuth::$client_secret . '&');
$params['sig'] = $sig;
}
//請求接口
$r = Http::request($url, $params, $method, $multi);
/*
$http = new Http2();
$r = $http->request($url, $method, $params, $multi);
*/
$r = preg_replace('/[^\\x20-\\xff]*/', "", $r);
//清除不可見字符
$r = iconv("utf-8", "utf-8//ignore", $r);
//UTF-8轉碼
//調試信息
if (self::$debug) {
echo '<pre>';
echo '接口:' . $url;
echo '<br>請求參數:<br>';
print_r($params);
echo '返回結果:' . $r;
echo '</pre>';
}
return $r;
}
示例4: LOGIN_DES_KEY
function LOGIN_DES_KEY()
{
if (!es_session::is_set("DES_KEY")) {
require_once APP_ROOT_PATH . "system/utils/es_string.php";
es_session::set("DES_KEY", es_string::rand_string(50));
}
return es_session::get("DES_KEY");
}
示例5: callback
public function callback()
{
OAuth::init($this->api['config']['app_key'], $this->api['config']['app_secret']);
Tencent::$debug = $debug;
$callback = SITE_DOMAIN . APP_ROOT . "/api_callback.php?c=Tencent";
if (es_session::is_set('t_access_token') || es_session::is_set('t_openid') && es_session::is_set('t_openkey')) {
//用戶已授權
//echo '<pre><h3>已授權</h3>用戶信息:<br>';
//獲取用戶信息
$r = Tencent::api('user/info');
$json_data = json_decode($r, true);
//print_r($json_data);
// echo '</pre>';
} else {
if ($_GET['code']) {
//已獲得code
$code = $_GET['code'];
$openid = $_GET['openid'];
$openkey = $_GET['openkey'];
//獲取授權token
$url = OAuth::getAccessToken($code, $callback);
$r = Http::request($url);
parse_str($r, $out);
//存儲授權數據
if ($out['access_token']) {
es_session::set('t_access_token', $out['access_token']);
es_session::set('refresh_token', $out['refresh_token']);
es_session::set('expires_in', $out['expires_in']);
es_session::set('t_code', $code);
es_session::set('t_openid', $openid);
es_session::set('t_openkey', $openkey);
//驗證授權
$r = OAuth::checkOAuthValid();
if ($r) {
app_redirect($callback);
//刷新頁麵
} else {
exit('<h3>授權失敗,請重試</h3>');
}
} else {
exit($r);
}
} else {
//獲取授權code
if ($_GET['openid'] && $_GET['openkey']) {
//應用頻道
s_session::set('t_openid', $_GET['openid']);
es_session::set('t_openkey', $_GET['openkey']);
//驗證授權
$r = OAuth::checkOAuthValid();
if ($r) {
app_redirect($callback);
//刷新頁麵
} else {
exit('<h3>授權失敗,請重試</h3>');
}
} else {
$url = OAuth::getAuthorizeURL($callback);
app_redirect($url);
}
}
}
if ($json_data['msg'] != "ok") {
echo '<pre><h3>出錯了</h3><pre>';
die;
}
$is_bind = intval($_REQUEST['is_bind']);
$tencent_id = $json_data['data']['openid'];
$msg['field'] = 'tencent_id';
$msg['id'] = $tencent_id;
$msg['name'] = $json_data['data']['name'];
es_session::set("api_user_info", $msg);
$user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where tencent_id = '" . $tencent_id . "' and tencent_id <> ''");
if ($user_data) {
$user_current_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where id = " . intval($user_data['group_id']));
$user_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where score <=" . intval($user_data['score']) . " order by score desc");
if ($user_current_group['score'] < $user_group['score']) {
$user_data['group_id'] = intval($user_group['id']);
}
//$GLOBALS['db']->query("update ".DB_PREFIX."user set tencent_app_key ='".$last_key['oauth_token']."',tencent_app_secret = '".$last_key['oauth_token_secret']."', login_ip = '".get_client_ip()."',login_time= ".TIME_UTC.",group_id=".intval($user_data['group_id'])." where id =".$user_data['id']);
//$GLOBALS['db']->query("update ".DB_PREFIX."deal_cart set user_id = ".intval($user_data['id'])." where session_id = '".es_session::id()."'");
es_session::delete("api_user_info");
if ($is_bind) {
if (intval($user_data['id']) != intval($GLOBALS['user_info']['id'])) {
showErr("該帳號已經被別的會員綁定過,請直接用帳號登錄", 0, url("shop", "uc_center#setweibo"));
} else {
es_session::set("user_info", $user_data);
app_redirect(url("shop", "uc_center#setweibo"));
}
} else {
es_session::set("user_info", $user_data);
app_recirect_preview();
}
} elseif ($is_bind == 1 && $GLOBALS['user_info']) {
//當有用戶身份且要求綁定時
$GLOBALS['db']->query("update " . DB_PREFIX . "user set tencent_id= '" . $tencent_id . "' where id =" . $GLOBALS['user_info']['id']);
app_redirect(url("index", "uc_center#setweibo"));
} else {
$this->create_user();
//app_redirect(url("index","user#api_login"));
//.........這裏部分代碼省略.........