public function __construct() { parent::__construct(); global $configs; $this->cache_dir = APPPATH . 'cache/cssjsless/'; $this->def_dir = $configs->config->theme_path; }
/** * 重载callback() * 将微信服务器请求的数据进行解析 * 并回调控制器的接口方法 */ public function callback() { $postXML = parent::callback(); empty($_GET) && die; // 必须有附带参数 extract($_GET); if ($this->sha1_sign($postXML->Encrypt, $timest, $nonce, $msg_signature)) { $req = $this->crypt_extract(parent::callback()); $reply = ''; switch (strtolower($req->MsgType)) { case 'text': $reply = ES_controller::get_instance()->_keywords($req->Content); break; case 'event': $reply = ES_controller::get_instance()->_events($req); break; } empty($reply) && die; list($method, $args) = $reply; $args = array('to' => $req->FromUserName, 'from' => $req->ToUserName) + $args; $reflector = new ReflectionClass('Reply'); $rMethod = $reflector->getMethod($method); $xml = $rMethod->invokeArgs($reflector->newInstanceWithoutConstructor(), $args); // log_msg($xml); // 未加密的消息体 $xml = $this->crypt_generate($xml); $signature = $this->set_sha1_sign($xml, $timestamp, $nonce); $xml = Reply::crypt_xml($xml, $signature, $timestamp, $nonce); // log_msg($xml); // 加密后的消息体 echo $xml; exit; } exit; }
public function __construct() { parent::__construct(); $this->load->helper('html'); }
public function __construct() { parent::__construct(); $this->load->library('api_wechat/mp_wechat', 'wechat'); $this->wechat->_init($this->appid, $this->appSecret, $this->encodingAesKey); }
/** * 载入视图 * @param string $dir html/php视图的文件路径,application/views下的什么位置 * @param array $data * * @return void */ public function view($dir, $data = array()) { !empty($data) && is_array($data) && extract($data); $file = APPPATH . $this->dir_view . 'html/' . $dir . '.php'; is_file($file) || show_500('view文件不存在,' . $file); ob_start(); include $file; $output = ob_get_contents(); @ob_end_clean(); $controller = ES_controller::get_instance(); $controller->output->append_output($output); }