本文整理匯總了PHP中WeUtility::checkSign方法的典型用法代碼示例。如果您正苦於以下問題:PHP WeUtility::checkSign方法的具體用法?PHP WeUtility::checkSign怎麽用?PHP WeUtility::checkSign使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WeUtility
的用法示例。
在下文中一共展示了WeUtility::checkSign方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: start
public function start() {
if(empty($this->token)) {
exit('Access Denied');
}
if(!WeUtility::checkSign($this->token)) {;
exit('Access Denied');
}
if(strtolower($_SERVER['REQUEST_METHOD']) == 'get') {
exit($_GET['echostr']);
}
if(strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
$this->message = WeUtility::parse($postStr);
if (empty($this->message)) {
WeUtility::logging('waring', 'Request Failed');
exit('Request Failed');
}
WeUtility::logging('trace', $this->message);
$this->before();
$this->response = $this->matcher();
$this->response['content'] = $this->process();
if(empty($this->response['content']) || ($this->response['content']['type'] == 'text' && empty($this->response['content']['content'])) || ($this->response['content']['type'] == 'news' && empty($this->response['content']['items']))) {
$this->response['module'] = 'default';
$this->response['content'] = $this->process();
}
$this->after();
WeUtility::logging('response', $this->response);
exit(WeUtility::response($this->response['content']));
}
WeUtility::logging('waring', 'Request Failed');
exit('Request Failed');
}
示例2: start
public function start()
{
global $_W;
if (empty($this->token)) {
exit('Access Denied');
}
if (!WeUtility::checkSign($this->token)) {
exit('Access Denied');
}
if (strtolower($_SERVER['REQUEST_METHOD']) == 'get') {
ob_clean();
ob_start();
exit($_GET['echostr']);
}
if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
$this->message = WeUtility::parse($postStr);
if (empty($this->message)) {
WeUtility::logging('waring', 'Request Failed');
exit('Request Failed');
}
$sessionid = md5($this->message['from'] . $this->message['to'] . $_W['weid']);
session_id($sessionid);
WeSession::$weid = $_W['weid'];
WeSession::$from = $this->message['from'];
WeSession::$expire = 3600;
WeSession::start();
WeUtility::logging('trace', $this->message);
$pars = $this->matcher();
$pars[] = array('module' => 'default', 'rule' => '-1');
foreach ($pars as $par) {
if (empty($par['module'])) {
continue;
}
$this->params = $par;
$this->response = $this->process();
if (is_array($this->response) && ($this->response['type'] == 'text' && !empty($this->response['content']) || $this->response['type'] == 'news' && !empty($this->response['items']) || !in_array($this->type, array('text', 'news')))) {
if (!empty($par['keyword'])) {
$this->keyword = $par['keyword'];
}
break;
}
}
WeUtility::logging('params', $this->params);
WeUtility::logging('response', $this->response);
$resp = WeUtility::response($this->response);
$mapping = array('[from]' => $this->message['from'], '[to]' => $this->message['to'], '[rule]' => $this->params['rule']);
echo str_replace(array_keys($mapping), array_values($mapping), $resp);
$subscribes = array();
foreach ($_W['account']['modules'] as $m) {
if (in_array($m['name'], $this->modules) && is_array($m['subscribes']) && !empty($m['subscribes'])) {
$subscribes[] = $m;
}
}
if (!empty($subscribes)) {
$this->subscribe($subscribes);
}
exit;
}
WeUtility::logging('waring', 'Request Failed');
exit('Request Failed');
}