* Do not call this method directly as it is a PHP magic method that * will be implicitly called when an unknown method is being invoked. * @param string $name the method name * @param array $params method parameters * @throws UnknownMethodException when calling unknown method * @return mixed the method return value */ public function __call($name, $params) { throw new UnknownMethodException('Calling unknown method: ' . get_class($this) . "::$name()"); } /** * Returns a value indicating whether a property is defined. * * A property is defined if: * * - the class has a getter or setter method associated with the specified name * (in this case, property name is case-insensitive);
'image' => $this->_category['image'] ? Yii::$service->category->image->getUrl($this->_category['image']) : '', 'description' => Yii::$service->store->getStoreAttrVal($this->_category['description'], 'description'), 'products' => $products, 'query_item' => $this->getQueryItem(), 'product_page' => $this->getProductPage(), 'refine_by_info' => $this->getRefineByInfo(), 'filter_info' => $this->getFilterInfo(), 'filter_price' => $this->getFilterPrice(), 'filter_category' => $this->getFilterCategory(), //'content' => Yii::$service->store->getStoreAttrVal($this->_category['content'],'content'), //'created_at' => $this->_category['created_at'], ]; }
Yii::$service->page->theme->layoutFile = 'category_view.php'; } // 分类页面。 public function actionIndex() { $data = $this->getBlock()->getLastData(); if(is_array($data)){ return $this->render($this->action->id, $data); } } /** * Yii2 behaviors 可以参看地址:http://www.yiichina.com/doc/guide/2.0/concept-behaviors
$args = $this->controller->bindActionParams($this, $params); Yii::debug('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 = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ 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();
* 使用方法:Yii::$service->cms->article; * 上面的例子就是获取cms服务的子服务article。 */ new fecshop\services\Application($config); $application = new yii\web\Application($config); $application->run();
$_GET = [ 'sort' => 'stock', 'dir' => 'desc', 'id' => '9', ]; $_SESSION = [ '__flash' => [], 'currency_current' => 'CNY', ];