本文整理汇总了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');
}