Zend Framework 2的View Helper中使用Service Manager

阅读更多
serviceLocator = $serviceLocator;
		return $this;
	}
	
	/**
	 * Get the service locator.
	 *
	 * @return \Zend\ServiceManager\ServiceLocatorInterface
	 */
	public function getServiceLocator() {
		return $this->serviceLocator;
	}

	public function __invoke($in) {
		$config = $this->getServiceLocator()->getServiceLocator()->get('application')->getConfig();
		return $config['URL'][$in];
	}
}

 

你可能感兴趣的:(php,zend,view,helper,service,manager)