// $data["CONTENT"] = stream_get_contents($data["CONTENT"]); // $memData = Yii::$app->cache->get('news_'.$id); // if($memData["expire_time"]-time()>0){ // $data = $memData["data"]; // }else{ $data= GeneralNewsSearch::find() ->where(['ID'=>$id, 'DISPLAY_FLAG'=>1,'CHECK_FLAG'=>GeneralNews::CHECK_FLAG_PASS]) ->andWhere(['LANGUAGE'=>CConst::getSiteLanguageId()]) ->one(); $data["CONTENT"] = stream_get_contents($data["CONTENT"]); // $rearr=[ // "data"=>$data, // 'expire_time' => time() + 3600*24*7, // ]; // Yii::$app->cache->set('news_'.$id, $rearr); // } //新闻详情含clob,不能做缓存 // $data= GeneralNewsSearch::find() // ->where(['ID'=>$id, 'DISPLAY_FLAG'=>1,'CHECK_FLAG'=>GeneralNews::CHECK_FLAG_PASS])
// $data = $memData["data"]; // }else{ $data= GeneralNewsSearch::find() ->where(['ID'=>$id, 'DISPLAY_FLAG'=>1,'CHECK_FLAG'=>GeneralNews::CHECK_FLAG_PASS]) ->andWhere(['LANGUAGE'=>CConst::getSiteLanguageId()]) ->one(); $data["CONTENT"] = stream_get_contents($data["CONTENT"]); // $rearr=[ // "data"=>$data, // 'expire_time' => time() + 3600*24*7, // ]; // Yii::$app->cache->set('news_'.$id, $rearr); // }
$news = new GeneralNewsSearch(); $id =(int)$id; if(strpos((string)$id,'061')>0){ Yii::$app->vcounter->addmess([$id]); } $data = $news->getNewShow($id); $data["TITLE"] = GeneralNews::findNewsOne($id)->TITLE; if(!$data) { return $this->redirect(['/news/']); // throw new NotFoundHttpException(Yii::t('app', '页面不存在')); }
$args = $this->controller->bindActionParams($this, $params); Yii::trace('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); Yii::$app->controller = $oldController; return $result; } else { $id = $this->getUniqueId(); throw new InvalidRouteException('Unable to resolve the request "' . ($id === '' ? $route : $id . '/' . $route) . '".');
$params = $this->catchAll; unset($params[0]); } try { Yii::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result;
try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
$config['components']['urlManager']['rules']['<controller:(largedata)>/<action:(index)>/<id:\d+>']='<controller>/<action>'; $config['components']['urlManager']['rules']['<controller:(largedata)>/<action:(view)>/<id:\d+>/<inframe:\d+>/<num:\d+>']='<controller>/<action>'; $config['components']['urlManager']['rules']['<controller:(largedata)>/<action:(view)>/<id:\d+>']='<controller>/<action>'; $config['components']['urlManager']['rules']['<controller:(pts)>/<action:(index)>/<id:\d+>']='<controller>/<action>'; } $application = new yii\web\Application($config); $application->run();
$_GET = [ 'id' => '4599187', 'lang' => 'en', ]; $_SERVER = [ 'REDIRECT_STATUS' => '200', 'HTTP_ACCEPT' => '*/*', 'HTTP_USER_AGENT' => 'claudebot', 'HTTP_HOST' => 'bg.coalresource.com:90', 'PATH' => '/usr/bin:/bin', 'SERVER_SIGNATURE' => '', 'SERVER_SOFTWARE' => 'Apache', 'SERVER_NAME' => 'bg.coalresource.com', 'SERVER_ADDR' => '10.0.0.12', 'SERVER_PORT' => '90', 'REMOTE_ADDR' => '34.205.2.207', 'DOCUMENT_ROOT' => '/web/english_test/frontend/web', 'REQUEST_SCHEME' => 'http', 'CONTEXT_PREFIX' => '', 'CONTEXT_DOCUMENT_ROOT' => '/web/english_test/frontend/web', 'SERVER_ADMIN' => 'you@example.com', 'SCRIPT_FILENAME' => '/web/english_test/frontend/web/index.php', 'REMOTE_PORT' => '41238', 'REDIRECT_URL' => '/news/4599187/info/en', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => '', 'REQUEST_URI' => '/news/4599187/info/en', 'SCRIPT_NAME' => '/index.php', 'PHP_SELF' => '/index.php', 'REQUEST_TIME_FLOAT' => 1711727858.6619999, 'REQUEST_TIME' => 1711727858, ];