接收数据
@return bool | Swoole\Http\WebSocketFrame
@throws Swoole\Http\WebSocketException
354111
function recv()
    {
        if (!$this->handshake)
        {
            trigger_error("not complete handshake.");
            return false;
        }
        if ($this->buffer and  $offset = stripos($this->buffer,"\r\n\r\n") !== false)
        {
            $packet = substr($this->buffer, 0, $offset + 4);
            $next = substr($this->buffer, $offset + 4);
            if ($next) {
                $this->buffer = $next;
            }
            $this->parser->push($packet);
            $frame = $this->parser->pop();
            if ($frame)
            {
                return $frame->data;
            }
        } else {
            while (true)
            {
                $data = $this->socket->recv();
                if ($this->buffer) {
                    $data = $this->buffer.$data;
                    $this->buffer = '';
                }
                if (!$data)
                {
                    return false;
                }
                $this->parser->push($data);
                $frame = $this->parser->pop();
                if ($frame)
                {
                    return $frame->data;
                }
            }
        }
        return false;
    }
106949
public function parse()
    {
        if (!$this->checkToken()) {
            return $this->parseRet = array('code' => -1, 'message' => 'Token不正确');
        }

        $attrs = $this->xmlToArray($this->postData);
        if ($this->isEncrypted()) {
            $ret = $this->decryptMsg($attrs['Encrypt']);
            if ($ret['code'] !== 1) {
                return $this->parseRet = $ret;
            }
            $attrs = $this->xmlToArray($ret['xml']);
        }

        $this->attrs = $attrs;
        return $this->parseRet = array('code' => 1, 'message' => '解析成功');
    }
639219
public function make()
    {
        try {
            $args = func_get_args();
            $active = $args[1]['active'] ?? true;

            // If widget has non active status.
            if (! $active) {
                return false;
            }

            $this->widgetName = trim((string) array_shift($args));
            $this->widgetParams = (array) array_shift($args);
            $this->widget = $this->getWidget();

            return $this->getContentFromCache();
        } catch (\Exception $e) {
            return sprintf(
                trans('common.msg.error'), $e->getMessage()
            );
        }
    }
183056
public function execute()
    {
        $msg = $this->phpci->interpolate($this->message);

        if (empty($this->server) || empty($this->room) || empty($this->nick)) {
            $this->phpci->logFailure(Lang::get('irc_settings'));
        }

        if (empty($this->port)) {
            $this->port = 6667;
        }

        $sock = fsockopen($this->server, $this->port);
        stream_set_timeout($sock, 1);

        $connectCommands = array(
            'USER ' . $this->nick . ' 0 * :' . $this->nick,
            'NICK ' . $this->nick,
        );
        $this->executeIrcCommands($sock, $connectCommands);
        $this->executeIrcCommand($sock, 'JOIN ' . $this->room);
        $this->executeIrcCommand($sock, 'PRIVMSG ' . $this->room . ' :' . $msg);

        fclose($sock);

        return true;
    }
267458
public function get() {
		$this->RoutedStatus = FALSE;

		if ( ! $this->route->isGet() ) {
			return $this;
		}

		if ( is_callable( $this->callable ) ) {
			//$this->RoutedStatus = FALSE;
			return $this;
		}

		$this->middleware = array( 'before' => array(), 'after' => array() );
		self::$FullRender = '';
		$args             = func_get_args();

		if ( ! empty( self::$group ) ) {

			if ( $args[0] == '/' ) {
				$args[0] = substr( self::$group, 0, - 1 );
			} else {
				$args[0] = self::$group . $args[0];
			}

		}

		array_push( Route::$list, $args[0] );
		$this->setCallable( $args );

		return $this;
	}
935840
public function getScriptUrl()
    {
        if (!$this->scriptUrl) {
            $scriptName = 'index.php';
            if(false != $scriptUrl = $this->getServer('PHP_SELF')) {
                $scriptName = $this->getServer('SCRIPT_FILENAME');
                // 去掉 index.php之后的字符
                if (false !== ($pos = stripos($scriptUrl, basename($scriptName)))) {
                    $scriptUrl = substr($scriptUrl, 0, $pos + strlen(basename($scriptName)));
                }
                
                if($scriptName && $scriptName == $scriptUrl) {
                    $docRoot = $this->getServer('DOCUMENT_ROOT');
                    if($docRoot && strpos($scriptName, $docRoot) === 0) {
                        $scriptUrl = str_replace('\\','/', str_replace($docRoot, '', $scriptName));
                    } else {
                        $scriptUrl = '/'.basename($scriptName);
                    }
                } elseif ($scriptName && strlen($scriptName) < strlen($scriptUrl)) {
                    $scriptUrl = '/'.basename($scriptName);
                } else {
                    //$scriptUrl = $scriptUrl;
                }
            } else {
                $scriptUrl = '/'.basename($scriptName);
            }
            
            $this->scriptUrl = htmlentities($scriptUrl);
        }
        
        return $this->scriptUrl;
    }
645471
public function getSslSelfLink()
    {
        if ($this->isAdmin()) {
            // using getSelfLink() method in admin mode (#2745)
            return $this->getSelfLink();
        }

        if (($sValue = $this->getViewConfigParam('sslselflink')) === null) {
            $sValue = $this->getConfig()->getShopSecureHomeURL();
            $this->setViewConfigParam('sslselflink', $sValue);
        }

        return $sValue;
    }
662510
public function send()
    {
        $provider = $this->getProvider();
        if (!$provider) {
            throw new \RuntimeException('未设置短信供应商');
        }

        $provider->send($this);

        return $this;
    }
882796
public function saveRemote()
    {
        $imgUrl = htmlspecialchars($this->fileField);
        $imgUrl = str_replace("&amp;", "&", $imgUrl);

        //http开头验证
        if (strpos($imgUrl, "http") !== 0) {
            $this->stateInfo = Yii::t('attachment', 'The link is not an http link.');
            return false;
        }
        $http = new Client();
        $response = $http->get($imgUrl)->send();
        if (!$response->isOk) {
            $this->stateInfo = Yii::t('attachment', 'The link is not available.');
            return false;
        } else {
            //格式验证(扩展名验证和Content-Type验证)
            $this->oriName = basename($imgUrl);
            $this->fileSize = strlen($response->content);
            $this->fileType = $this->getExtension();
            $this->fullName = $this->getFullName();
            $this->filePath = $this->getFilePath();
            $this->fileName = $this->getFileName();
            $dirName = dirname($this->filePath);

            //检查文件类型
            if (!$this->checkType()) {
                $this->stateInfo = Yii::t('attachment', 'The link contentType is incorrect.');
                return false;
            }
            if (!isset($response->headers['content-type']) || !stristr($response->headers['content-type'], "image")) {
                $this->stateInfo = Yii::t('attachment', 'The link contentType is incorrect.');
                return false;
            }

            //检查文件大小是否超出限制
            if (!$this->checkSize()) {
                $this->stateInfo = Yii::t('attachment', 'The file size exceeds the site limit.');
                return false;
            }

            if (!is_dir($dirName)) {//递归创建保存目录
                FileHelper::createDirectory($dirName, $this->dirMode, true);
            }
            //检查文件大小是否超出限制
            if (!$this->checkSize()) {
                $this->stateInfo = Yii::t('attachment', 'The file size exceeds the site limit.');
                return false;
            }
            //移动文件
            if (!(file_put_contents($this->filePath, $response->content) && file_exists($this->filePath))) { //移动失败
                $this->stateInfo = Yii::t('attachment', 'An error occurred while saving the file.');
                return false;
            } else { //移动成功
                $this->saveModel();
                $this->stateInfo = 'SUCCESS';
                return true;
            }
        }
    }
87703
public function sendHeaders()
    {
        if (headers_sent()) {
            return $this;
        }

        if (isset($this->headers['Location']) && $this->code === 200) {
            $this->setStatusCode(302);
        }

        // 发送状态码
        http_response_code($this->code);

        // 发送自定义响应头
        foreach ($this->headers as $header => $value) {
            if (empty($value)) {
                header($header, true);
            } else {
                header("$header: $value", true);
            }
        }

        return $this;
    }
350353
public function verify()
    {
        if(strtoupper($this->vitex->env->method()) == 'POST' ||
            strtoupper($this->vitex->env->method()) == 'PUT'
        ) {
            $token = $this->vitex->req->body->_token;
            if(!$token){
                $token = $this->vitex->env->get('HTTP_X_CSRF_TOKEN');
            }
            $cookieToken = $this->vitex->req->cookies->csrf_token;
            $pathinfo = $this->vitex->env->getPathinfo();
            $except = $this->vitex->getConfig('csrf.except');
            if($token != $cookieToken){
                /*
                 * 一个符合排除的链接就排除
                 */
                foreach($except as $pattern){
                    if($this->vitex->route->router->checkUrlMatch($pattern,$pathinfo)){
                        return true;
                    }
                }

                //验证失败出错
                $callback = $this->vitex->getConfig('csrf.onmismatch');
                if($callback){
                    call_user_func_array($callback,[$token,$cookieToken]);
                    exit;
                } else {
                    throw new TokenMismatchException("CSRF TOKEN验证失败",Exception::CODE_PARAM_VALUE_ERROR);
                }
            }
        }
        return true;
    }
667038
public function bindcomponent() {
        $url             = isset($_GET['url']) ? $_GET['url'] : '-1';
        $uid             = isset($_GET['uid']) ? $_GET['uid'] : '-1';
        $component_appid = C("wechat", "componentAppid");
        $pre_auth_code   = $this->getPreAuthCode();
        $redirect_uri    = urlencode(ROOT . '/' . md5('Wechat authorization callback') . "_wechat/url/" . $url . '/uid/' . $uid);
        $auth_type       = 3;
        $url             = "https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&auth_type=3&no_scan=1&component_appid=$component_appid&pre_auth_code=$pre_auth_code&redirect_uri=$redirect_uri&auth_type=$auth_type#wechat_redirect";
        $this7qrcode     = qrcode::base64($url);
        require dirname(dirname(__FILE__)) . "/bin/authorization.php";
        exit();
    }
1030654
public function send()
    {
        $result = $this->getAuthCode();

        // 跳转到CDKEY录入界面 DOC 3.2
        if ($result['TradeType'] == 1) {
            return [
                'auth_code' => $this->auth_code,
            ];
        }

        // 跳转到MyCard DOC 3.3
        if ($result['TradeType'] == 2) {
            $this->redirect();
        }
    }
1136069
private function getCurrentLink()
    {
        if (Yii::app() instanceof CWebApplication) {
            return Yii::app()->getRequest()->getHostInfo() . Yii::app()->getRequest()->getUrl();
        }
        $link = 'yiic ';
        if (isset($_SERVER['argv'])) {
            $argv = $_SERVER['argv'];
            array_shift($argv);
            $link .= implode(' ', $argv);
        }
        return trim($link);
    }
916192
protected function http() {
        // 若$this->http不是\GuzzleHttp\Client实例，则创建一个
        if (!$this->http instanceof Client) {
            $this->http = new Client(
                array_merge(
                    [ 'base_uri' => $this->url ],
                    $this->options
                )
            );
        }

        return $this->http;
    }
201016
private function handshake()
        {
            $url = $this->socketIOUrl;

            if (!empty($this->handshakeQuery)) {
                $url .= $this->handshakeQuery;
            }

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

            if (!$this->checkSslPeer) {
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
            }

            if (!is_null($this->handshakeTimeout)) {
                curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $this->handshakeTimeout);
                curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->handshakeTimeout);
            }

            $res = curl_exec($ch);

            if ($res === false || $res === '') {
                throw new \Exception(curl_error($ch));
            }

            $sess = explode(':', $res);
            $this->session['sid'] = $sess[0];
            $this->session['heartbeat_timeout'] = $sess[1];
            $this->session['connection_timeout'] = $sess[2];
            $this->session['supported_transports'] = array_flip(explode(',', $sess[3]));

            if (!isset($this->session['supported_transports']['websocket'])) {
                throw new \Exception('This socket.io server do not support websocket protocol. Terminating connection...');
            }

            return true;
        }
28160
public function run() {

		try {
			
			//初始化
			$this->init();

			//触发uri路由
			$this->make('router')->dispatch();

			//reset GET
			$_GET = $this->make('router')->getQueryArray();
			foreach ($_GET as $ik => $iv) {
				if (is_string($ik)) {
					$_REQUEST[$ik] = $iv;
				}
			}

			$this->runControllerAction();

			//结束
			$this->finish(0);

		} catch (\Exception $exception) {
			
			if ($this->currentController == null) {
				$this->currentController = new Controller($this, ''); //默认的controller
			}
			
			//触发事件
			$this->eventDispatcher->dispatchEvent(new \Fasim\Event\ExceptionEvent(\Fasim\Event\Event::$EXCEPTION, $exception));

			$config = $this->make('config');
			$view = $this->currentController->getView();
			$view->getLoader()->setPaths([ FS_PATH . 'View' ]);


			$debug = $this->make('config')->get('debug') === true;
			$traceString = str_replace("\n", "<br />\n", $traceString);
			$error = [
				'code' => $exception->getCode(),
				'message' => $exception->getMessage(),
				'file' => $exception->getFile(),
				'line' => $exception->getLine(),
				'trace' => $exception->getTrace()
			];
			$data = [
				'error' => $error,
				'debug' => $debug
			];
			
			if (file_exists(FS_PATH . 'View' . DIRECTORY_SEPARATOR . 'error' . $exception->getCode() . '.html')) {
				echo $view->render('error' . $exception->getCode() . '.html', $data);
			} else {
				echo $view->render('error500.html', $data);
			}
		
			//结束
			$this->finish(-1);
		}
	}