zend 菜单栏里面的css auto什么意思思

Zend Guard Loader | 奇才哥SEO观察Zend_Framework_学习笔记记录_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
Zend_Framework_学习笔记记录
上传于|0|0|文档简介
&&zend framework
阅读已结束,如果下载本文需要使用0下载券
想免费下载更多文档?
定制HR最喜欢的简历
下载文档到电脑,查找使用更方便
还剩12页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢Zend Framework2流程分析 - 推酷
Zend Framework2流程分析
自已用zf2(
)写了一个项目,正好写一个zend framework的运行流程的文章.
入口文件index
// Setup autoloading
require 'init_autoloader.php';
// Run the application!
Zend\Mvc\Application::init(require 'config/application.config.php')-&run();
在init_autoloader.php文件中它使用两种方式自动加载文件,一种是
(一种PHP包依赖管理器)加载,默认使用这个,如果没有他就会使用Zend框架自动的自动加载类.
下面主要讲下run()方法是怎么执行的,里面事件驱动,路由管理,等等.
run方法的代码如下:
Applicatino.php
public static function init($configuration = array())
//获取配置文件的服务
$smConfig = isset($configuration['service_manager']) ? $configuration['service_manager'] : array();
//获取配置文件的监听
$listeners = isset($configuration['listeners']) ? $configuration['listeners'] : array();
//初始化服务管理器
$serviceManager = new ServiceManager(new Service\ServiceManagerConfig($smConfig));
//设置应用配置
$serviceManager-&setService('ApplicationConfig', $configuration);
//加载模块
$serviceManager-&get('ModuleManager')-&loadModules();
//完成,request,reponse,render view
return $serviceManager-&get('Application')-&bootstrap($listeners);
ServiceManger.php
//初化一些类的别名,要调用的类,服务工厂
public function __construct(ConfigInterface $config = null)
if ($config) {
$config-&configureServiceManager($this);
$serviceManager-&setService(‘ServiceManager’, $serviceManager);这句代码比较重要,设置当前的服务管理器,为ServiceM
$serviceManager-&get(‘ModuleManager’)-&loadModules();
if (isset($this-&canonicalNames[$name])) {
$cName = $this-&canonicalNames[$name];
$cName = $this-&canonicalizeName($name);
get方法是获取了canonicalizeName数组有没有ModuleManager这个键,这里他用了一个叫DI的东西,JAVA用得比较,也叫依赖注入,可以看看Zend\Di这个库.
get的最终调用是
Zend\Mvc\Service\ModuleManagerFactory 的createService方法。这个里面会初始化一个默认的事件监听器和一个服务事件,还有一个moduleEvent事件对象和一个模块管理器.
$events = $serviceLocator-&get('EventManager');
$events-&attach($defaultListeners);
$events-&attach($serviceListener);
get返回的是一个Zend\ModuleManager\ModuleManager对象.
loadModules()方法,触发了两个事件,
public function loadModules()
if (true === $this-&modulesAreLoaded) {
$this-&getEventManager()-&trigger(ModuleEvent::EVENT_LOAD_MODULES, $this, $this-&getEvent());
* Having a dedicated .post event abstracts the complexity of priorities from the user.
* Users can attach to the .post event and be sure that important
* things like config merging are complete without having to worry if
* they set a low enough priority.
$this-&getEventManager()-&trigger(ModuleEvent::EVENT_LOAD_MODULES_POST, $this, $this-&getEvent());
加载了module目录下面文件,定义了模块的自动加载类,等 等 .
$serviceManager-&get(‘Application’);返回一个Zend\Mvc\Application对象.
分析bootstrap这个方法
public function bootstrap(array $listeners = array())
$serviceManager = $this-&serviceM
$events = $this-&
$listeners = array_unique(array_merge($this-&defaultListeners, $listeners));
//监听四个事件
foreach ($listeners as $listener) {
$events-&attach($serviceManager-&get($listener));
// Setup MVC Event
$this-&event = $event = new MvcEvent();
$event-&setTarget($this);
$event-&setApplication($this)
-&setRequest($this-&getRequest())
-&setResponse($this-&getResponse())
-&setRouter($serviceManager-&get('Router'));
// Trigger bootstrap events
$events-&trigger(MvcEvent::EVENT_BOOTSTRAP, $event);
serRouter($serviceManager-&get(‘Router’));
这里返回了一个Zend\Mvc\Router\Http\TreeRouteStack对象,路由是通过$config & & & & & & = $serviceLocator-&has(‘Config’) ? $serviceLocator-&get(‘Config’) : array();来获取的
所有页面渲染,路由决定,模板layout,等等&$events-&trigger(MvcEvent::EVENT_BOOTSTRAP, $event);都是通过事件触发的.
$events-&trigger(MvcEvent::EVENT_BOOTSTRAP, $event);需要触发5(根据模块的多少)个事件.
1.&Zend\Mvc\View\Http\ViewManager & &方法onBootstrap();
onBootstrap监听了,路由事件,调度事件,渲染事件,异常事件
2,触发一个闭包,LocatorRegistrationListener 文件70行.
3 , 执行模块的,&onBootstrap(); 我这边是Application\Moudle对象.
4,第二个模块的onBootstrap();事件.
5,第三个模块的onBootstrap();事件,
到最后一个run方法.
290行&$result = $events-&trigger(MvcEvent::EVENT_ROUTE, $event, $shortCircuit);触发路由事件.
这里会执行TreeRouteStack对象的match方法来匹配路由返回一个匹配的Zend\Mvc\Router\Http\RouteMatch对象
309行 $result = $events-&trigger(MvcEvent::EVENT_DISPATCH, $event, $shortCircuit);触发调度器事件
这个事件执行了Zend\Mvc\DispatchListener对象的onDispatch方法
然后会执行Zend\Mvc\Controller\AbstractActionController 调用onDispatch方法,里面会执行实例化的控制器的对应的方法
public function onDispatch(MvcEvent $e)
$routeMatch = $e-&getRouteMatch();
if (!$routeMatch) {
* @todo Determine requirements for when route match is missing.
* Potentially allow pulling directly from request metadata?
throw new Exception\DomainException('M unsure how to retrieve action');
$action = $routeMatch-&getParam('action', 'not-found');
$method = static::getMethodFromAction($action);
if (!method_exists($this, $method)) {
$method = 'notFoundAction';
$actionResponse = $this-&$method();
$e-&setResult($actionResponse);
return $actionR
所有的action都是返回一个ViewModel对象 , 就是上面的$actionResponse变量;
这里还是进入的事件循环.里面会设置一个模板的属性,404的模板,等等。当事件结束时
Zend\Mvc\DispatchListener&onDispatch方法
return $this-&complete($return, $e);
到后面会执行
protected function completeRequest(MvcEvent $event)
$events = $this-&getEventManager();
$event-&setTarget($this);
$events-&trigger(MvcEvent::EVENT_RENDER, $event);//渲染事件
$events-&trigger(MvcEvent::EVENT_FINISH, $event); //完成事件
我这边最后会执行到AbstractSessionArrayStorage 对象的析构函数,来结束整个流程
public function __destruct()
More from my site
已发表评论数()
请填写推刊名
描述不能大于100个字符!
权限设置: 公开
仅自己可见
正文不准确
标题不准确
排版有问题
主题不准确
没有分页内容
图片无法显示
视频无法显示
与原文不一致Autonpm|全自动编译安装nginx+php+mysql+ZendOptimizer的shell脚本_服务器应用_Linux公社-Linux系统门户网站
你好,游客
Autonpm|全自动编译安装nginx+php+mysql+ZendOptimizer的shell脚本
作者:srsman
Autonpm一个全自动编译安装nginx+php+mysql+ZendOptimizer的shell脚本,可自动从网络上下载相应的程序源代码到机器上编译、安装.批量安装服务器比较方便.
对于要马上从apache切换到nginx的新手来说更是方便
Autonpm下载地址
建议用5.X系统安装
安装完毕后常用文件和目录如下:
mysql dir: /usr/local/mysql
php dir: /usr/local/php
nginx dir: /usr/local/nginx
web dir: /home/wwwroot/www
nginx: /usr/local/nginx/sbin/nginx
nginx.conf: /usr/local/nginx/conf/nginx.conf
mysql: /usr/local/mysql/bin/mysql
<f: /usr/local/f
php: /usr/local/php/php
php.ini: /usr/local/php/etc/php.ini
本文来自:
相关资讯 & & &
& (03月27日)
& (01月12日)
& (05月09日)
& (02月09日)
& (11/15/:55)
   同意评论声明
   发表
尊重网上道德,遵守中华人民共和国的各项有关法律法规
承担一切因您的行为而直接或间接导致的民事或刑事法律责任
本站管理人员有权保留或删除其管辖留言中的任意内容
本站有权在网站内转载或引用您的评论
参与本评论即表明您已经阅读并接受上述条款

我要回帖

更多关于 auto什么意思 的文章

 

随机推荐