public function __get($name) { $getter = 'get' . $name; if (method_exists($this, $getter)) { return $this->$getter(); } elseif (method_exists($this, 'set' . $name)) { throw new InvalidCallException('Getting write-only property: ' . get_class($this) . '::' . $name); } throw new UnknownPropertyException('Getting unknown property: ' . get_class($this) . '::' . $name); } /** * Sets value of an object property. * * Do not call this method directly as it is a PHP magic method that * will be implicitly called when executing `$object->property = $value;`. * @param string $name the property name or the event name * @param mixed $value the property value
$products = $productCollInfo['coll']; $this->_productCount = $productCollInfo['count']; //echo $this->_productCount; return [ 'searchText' => $this->_searchText, 'title' => $this->_title, 'name' => Yii::$service->store->getStoreAttrVal($this->_category['name'], 'name'), '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(),
if (Yii::$service->store->isAppServerMobile()) { $searchText = Yii::$app->request->get('q'); $searchText = \Yii::$service->helper->htmlEncode($searchText); $urlPath = 'search/'.$searchText; Yii::$service->store->redirectAppServerMobile($urlPath); } $data = $this->getBlock()->getLastData(); return $this->render($this->action->id, $data); } }
$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 = [ 'q' => '牛仔裤', ]; $_SESSION = [ '__flash' => [], 'currency_current' => 'CNY', ];