if (function_exists('imagegif')) { $re = imagegif($img_thumb, $thumbname); } else { return $this->halt($this->lang_upfileFail9); } break; case 'image/pjpeg': case 'image/jpeg': if (function_exists('imagejpeg')) { $re = imagejpeg($img_thumb, $thumbname, 100); } else { return $this->halt($this->lang_upfileFail10); } break; case 'image/x-png': case 'image/png': if (function_exists('imagepng')) { $re = imagepng($img_thumb, $thumbname); } else {
return $this->halt($this->lang_upfileFail9); } break; case 'image/pjpeg': case 'image/jpeg': if (function_exists('imagejpeg')) { $re = imagejpeg($img_thumb, $thumbname, 100); } else { return $this->halt($this->lang_upfileFail10); } break; case 'image/x-png': case 'image/png':
//生成缩略图 if(strtolower($extend) == 'jpg'||strtolower($extend) == 'jpeg'||strtolower($extend) == 'bmp'||strtolower($extend) == 'png'||strtolower($extend) == 'gif'){ $upfile = new Upfile(); $upfile->upfile('', Yii::$app->params['uploader']['storageRootDirectory'].'thumb_src/', 0, '', 1); $upfile->savename = $filename.'.'.$extend; $imgurls = $upfile->createthumb($oldFullPath, $x, $y, $thumbDir, '', $thumb_kind, $thumb_pos); $imgurls = str_replace(Yii::$app->params['uploader']['storageRootDirectory'], $uploadUrl, $imgurls); unset($upfile,$filename,$extend,$oldFullPath,$x,$y,$thumbDir,$thumb_kind,$thumb_pos,$uploadUrl); return $imgurls ? $imgurls : $url .'" style="width:'.$width.'px;height:'.$height.'px;'; } }
<div class="hd"><h3>今日快讯</h3></div> <ul class="plist05"> <?php foreach($todayArticle as $key => $val) : ?> <?php if($key==0) : ?> <li> <a target="_blank" href="<?= Url::toArticleContentUrl($val) ?>"> <img alt="<?= Html::encode($val['title']) ?>" src="<?= Common::createThumb($val['thumb'], 280, 177) ?>"> <p class="patitle"><?= Html::encode($val['title']) ?></p> </a> </li> </ul> <ul class="plist03 l mt10 ml10"> <?php else : ?>
*/ public function renderPhpFile($_file_, $_params_ = []) { ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); require($_file_); return ob_get_clean(); } /** * Renders dynamic content returned by the given PHP statements.
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); } /* @var $renderer ViewRenderer */ $renderer = $this->renderers[$ext]; $output = $renderer->render($this, $viewFile, $params); } else { $output = $this->renderPhpFile($viewFile, $params); } $this->afterRender($viewFile, $params, $output); } array_pop($this->_viewFiles); $this->context = $oldContext;
} public function renderFile($viewFile, $params = [], $context = null) { if ($this->theme == null) { $this->setTheme(); } return parent::renderFile($viewFile, $params, $context); } public function setTheme() { }
* @throws InvalidCallException if the view cannot be resolved. * @see renderFile() */ public function render($view, $params = [], $context = null) { $viewFile = $this->findViewFile($view, $context); return $this->renderFile($viewFile, $params, $context); } /** * Finds the view file based on the given view name. * @param string $view the view name or the path alias of the view file. Please refer to [[render()]] * on how to specify this parameter.
* These parameters will not be available in the layout. * @return string the rendering result. * @throws InvalidParamException if the view file or the layout file does not exist. */ public function render($view, $params = []) { $content = $this->getView()->render($view, $params, $this); return $this->renderContent($content); } /** * Renders a static string by applying a layout. * @param string $content the static string being rendered
//互联网 $data['itArticle'] = Article::find()->where(['siteid'=>$this->siteid, 'status' => self::STATUS,'catid' => explode(',', $pathToCatid['it/']['arrchildid'])])->orderBy('`hits` DESC')->andWhere("`thumb` <> ''")->limit(5)->all(); //热门文章 $data['hotArticle'] = Article::find()->where(['siteid'=>$this->siteid, 'status' => self::STATUS, 'catid' => $category['id']])->andWhere("`thumb` <> ''")->orderBy('`hits` DESC')->limit(10)->all(); } return $this->render($templates, $data); }else{ return $this->actionError(); } }else{ //栏目已关闭 && 栏目不存在 return $this->actionError();
$category = $pathToCatid[$typedir]; //需要根据分类来调用数据、输出模板 switch ($category['moduleid']){ //文章 case 3: return $this->actionArticleView($first, $second, $third, $aid, $page); break; case 4: break; } }else{
$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); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = array_splice($this->catchAll, 1); } try { LuLu::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $actionsResult = $this->runAction($route, $params); $result = $actionsResult instanceof ActionResult ? $actionsResult->result : $actionsResult; if ($result instanceof \yii\web\Response) { return $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();
if($siteStatus == '0') { $sys_close_tips = isset($activeSites[$siteid]) ? $activeSites[$siteid]['close_tips'] : ''; $app->catchAll = ['/content/default/close', 'message' => $sys_close_tips]; } $app->run();
$_GET = [ 'first' => 'society', 'second' => 'anecdote', 'aid' => '54116', ];