# 调度控制器(Dispatching Controllers)[](# "永久链接至标题")
[*Phalcon\Mvc\Dispatcher*](#) 是MVC应用中负责实例化控制器和执行在这些控制器上必要动作的组件。理解它的操作和能力将能帮助我们获得更多Phalcon框架提供的服务。
### 循环调度(The Dispatch Loop)[](# "永久链接至标题")
在MVC流中,这是一个重要的处理环节,特别对于控制器这部分。这些处理发生在控制调度器中。控制器的文件将会被依次读取、加载和实例化。然后指定的action将会被执行。如果一个动作将这个流转发给了另一个控制器/动作,控制调度器将会再次启动。为了更好解释这一点,以下示例怡到好处地说明了在 [*Phalcon\Mvc\Dispatcher*](#) 中的处理过程:
~~~
<?php
// 循环调度
while (!$finished) {
$finished = true;
$controllerClass = $controllerName . "Controller";
// 通过自动加载器实例化控制器类
$controller = new $controllerClass();
// 执行action
call_user_func_array(array($controller, $actionName . "Action"), $params);
// $finished应该重新加载以检测MVC流
// 是否转发给了另一个控制器
$finished = true;
}
~~~
上面的代码缺少了验证,过滤器和额外的检查,但它演示了在调度器中正常的操作流。
### 循环调度事件(Dispatch Loop Events)[](# "永久链接至标题")
[*Phalcon\Mvc\Dispatcher*](#) 可以发送事件给当前的 [*EventsManager*](#) 。事件会以“dispatch”类型被所触发。当返回false时有些事件可以终止当前激活的操作。已支持的事件如下:
| 事件名称 | 何时触发 | 此操作是否可终止? | 触发于 |
|-----|-----|-----|-----|
| beforeDispatchLoop | 在进入循环调度前触发。此时,调度器不知道将要执行的控制器或者动作是否存在。调度器只知道路由传递过来的信息。 | 是 | 侦听者 |
| beforeDispatch | 在进入循环调度后触发。此时,调度器不知道将要执行的控制器或者动作是否存在。调度器只知道路由传递过来的信息。 | 是 | 侦听者 |
| beforeExecuteRoute | 在执行控制器/动作方法前触发。此时,调度器已经初始化了控制器并知道动作是否存在。 | 是 | 侦听者/控制器 |
| initialize | 允许在请求中全局初始化控制器。 | 否 | 控制器 |
| afterExecuteRoute | 在执行控制器/动作方法后触发。由于此操作不可终止,所以仅在执行动作后才使用此事件进行清理工作。 | 否 | 侦听者/控制器 |
| beforeNotFoundAction | 当控制器中的动作找不到时触发。 | 是 | 侦听者 |
| beforeException | 在调度器抛出任意异常前触发。 | 是 | 侦听者 |
| afterDispatch | 在执行控制器/动作方法后触发。由于此操作不可终止,所以仅在执行动作后才使用此事件进行清理工作。 | 是 | 侦听者 |
| afterDispatchLoop | 在退出循环调度后触发。 | 否 | 侦听者 |
[*INVO*](#) 这篇导读说明了如何从通过结合 [*Acl*](#) 实现的一个安全过滤器中获得事件调度的好处。
以下例子演示了如何将侦听者绑定到组件上:
~~~
<?php
use Phalcon\Mvc\Dispatcher as MvcDispatcher,
Phalcon\Events\Manager as EventsManager;
$di->set('dispatcher', function () {
// 创建一个事件管理
$eventsManager = new EventsManager();
// 为“dispatch”类型附上一个侦听者
$eventsManager->attach("dispatch", function ($event, $dispatcher) {
// ...
});
$dispatcher = new MvcDispatcher();
// 将$eventsManager绑定到视图组件
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
}, true);
~~~
一个实例化的控制器会自动作为事件调度的侦听者,所以你可以实现回调函数:
~~~
<?php
class PostsController extends \Phalcon\Mvc\Controller
{
public function beforeExecuteRoute($dispatcher)
{
// 在每一个找到的动作前执行
}
public function afterExecuteRoute($dispatcher)
{
// 在每一个找到的动作后执行
}
}
~~~
### 转发到其他动作(Forwarding to other actions)[](# "永久链接至标题")
循环调度允许我们转发执行流到另一个控制器/动作。这对于检查用户是否可以访问页面,将用户重定向到其他屏幕或简单地代码重用都非常有用。
~~~
<?php
class PostsController extends \Phalcon\Mvc\Controller
{
public function indexAction()
{
}
public function saveAction($year, $postTitle)
{
// .. 储存一些产品并且转发用户
// 将流转发到index动作
$this->dispatcher->forward(array(
"controller" => "post",
"action" => "index"
));
}
}
~~~
请注意制造一个“forward”并不等同于制造一个HTTP的重定向。尽管这两者表面上最终效果都一样。“forward”不会重新加载当前页面,全部的重定向都只发生在一个请求里面,而HTTP重定向则需要两次请求才能完成这个流程。
更多转发示例:
~~~
<?php
// 将流转发到当前控制器的另一个动作
$this->dispatcher->forward(array(
"action" => "search"
));
// 将流转发到当前控制器的另一个动作
// 传递参数
$this->dispatcher->forward(array(
"action" => "search",
"params" => array(1, 2, 3)
));
~~~
一个转发的动作可以接受以下参数:
| 参数 | 触发 |
|-----|-----|
| controller | 一个待转发且有效的控制器名字。 |
| action | 一个待转发且有效的动作名字。 |
| params | 一个传递给动作的数组参数。 |
| namespace | 一个控制器对应的命名空间名字。 |
### 准备参数(Preparing Parameters)[](# "永久链接至标题")
多得 [*Phalcon\Mvc\Dispatcher*](#) 提供的钩子函数, 你可以简单地调整你的应用来匹配URL格式:
例如,你想把你的URL看起来像这样:[http://example.com/controller/key1/value1/key2/value](http://example.com/controller/key1/value1/key2/value)
默认下,参数会按URL传递的顺序传给对应的动作,你可以按期望来转换他们:
~~~
<?php
use Phalcon\Dispatcher,
Phalcon\Mvc\Dispatcher as MvcDispatcher,
Phalcon\Events\Manager as EventsManager;
$di->set('dispatcher', function () {
// 创建一个事件管理
$eventsManager = new EventsManager();
// 附上一个侦听者
$eventsManager->attach("dispatch:beforeDispatchLoop", function ($event, $dispatcher) {
$keyParams = array();
$params = $dispatcher->getParams();
// 用奇数参数作key,用偶数作值
foreach ($params as $number => $value) {
if ($number & 1) {
$keyParams[$params[$number - 1]] = $value;
}
}
// 重写参数
$dispatcher->setParams($keyParams);
});
$dispatcher = new MvcDispatcher();
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});
~~~
如果期望的链接是这样: [http://example.com/controller/key1:value1/key2:value](http://example.com/controller/key1:value1/key2:value),那么就需要以下这样的代码:
~~~
<?php
use Phalcon\Dispatcher,
Phalcon\Mvc\Dispatcher as MvcDispatcher,
Phalcon\Events\Manager as EventsManager;
$di->set('dispatcher', function () {
// 创建一个事件管理
$eventsManager = new EventsManager();
// 附上一个侦听者
$eventsManager->attach("dispatch:beforeDispatchLoop", function ($event, $dispatcher) {
$keyParams = array();
$params = $dispatcher->getParams();
// 将每一个参数分解成key、值 对
foreach ($params as $number => $value) {
$parts = explode(':', $value);
$keyParams[$parts[0]] = $parts[1];
}
// 重写参数
$dispatcher->setParams($keyParams);
});
$dispatcher = new MvcDispatcher();
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});
~~~
### 获取参数(Getting Parameters)[](# "永久链接至标题")
当路由提供了命名的参数变量,你就可以在控制器、视图或者任何一个继承了[*Phalcon\DI\Injectable*](#) 的组件中获得这些参数。
~~~
<?php
class PostsController extends \Phalcon\Mvc\Controller
{
public function indexAction()
{
}
public function saveAction()
{
// 从URL传递过来的参数中获取title
// 或者在一个事件中准备
$title = $this->dispatcher->getParam("title");
// 从URL传递过来的参数中获取year
// 或者在一个事件中准备并且进行过滤
$year = $this->dispatcher->getParam("year", "int");
}
}
~~~
### 准备行动(Preparing actions)[](# "永久链接至标题")
你也可以为动作定义一个调度前的映射表。
### 转换动作名(Camelize action names)[](# "永久链接至标题")
如果原始链接是:[http://example.com/admin/products/show-latest-products](http://example.com/admin/products/show-latest-products),例如你想把'show-latest-products'转换成'ShowLatestProducts',需要以下代码:
~~~
<?php
use Phalcon\Text,
Phalcon\Mvc\Dispatcher as MvcDispatcher,
Phalcon\Events\Manager as EventsManager;
$di->set('dispatcher', function () {
// 创建一个事件管理
$eventsManager = new EventsManager();
// Camelize动作
$eventsManager->attach("dispatch:beforeDispatchLoop", function ($event, $dispatcher) {
$dispatcher->setActionName(Text::camelize($dispatcher->getActionName()));
});
$dispatcher = new MvcDispatcher();
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});
~~~
### 删除遗留的扩展名(Remove legacy extensions)[](# "永久链接至标题")
如果原始链接总是包含一个'.php'扩展名:
[http://example.com/admin/products/show-latest-products.php](http://example.com/admin/products/show-latest-products.php)[http://example.com/admin/products/index.php](http://example.com/admin/products/index.php)
你可以在调度对应的控制器/动作组前将它删除:
~~~
<?php
use Phalcon\Mvc\Dispatcher as MvcDispatcher,
Phalcon\Events\Manager as EventsManager;
$di->set('dispatcher', function () {
// 创建一个事件管理
$eventsManager = new EventsManager();
// 在调度前删除扩展
$eventsManager->attach("dispatch:beforeDispatchLoop", function ($event, $dispatcher) {
// 删除扩展
$action = preg_replace('/\.php$/', '', $dispatcher->getActionName());
// 重写动作
$dispatcher->setActionName($action);
});
$dispatcher = new MvcDispatcher();
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});
~~~
### 注入模型实例(Inject model instances)[](# "永久链接至标题")
在这个实例中,开发人员想要观察动作接收到的参数以便可以动态注入模型实例。
控制器看起来像这样:
~~~
<?php
class PostsController extends \Phalcon\Mvc\Controller
{
/**
* 显示$post
*
* @param \Posts $post
*/
public function showAction(Posts $post)
{
$this->view->post = $post;
}
}
~~~
‘showAction'方法接收到一个 Posts 模型的实例,开发人员可以在调度动作和准备映射参数前进行观察:
~~~
<?php
use Phalcon\Text,
Phalcon\Mvc\Dispatcher as MvcDispatcher,
Phalcon\Events\Manager as EventsManager;
$di->set('dispatcher', function () {
// 创建一个事件管理
$eventsManager = new EventsManager();
$eventsManager->attach("dispatch:beforeDispatchLoop", function ($event, $dispatcher) {
// 可能的控制器类名
$controllerName = Text::camelize($dispatcher->getControllerName()) . 'Controller';
// 可能的方法名
$actionName = $dispatcher->getActionName() . 'Action';
try {
// 从反射中获取将要被执行的方法
$reflection = new \ReflectionMethod($controllerName, $actionName);
// 参数检查
foreach ($reflection->getParameters() as $parameter) {
// 获取期望的模型名字
$className = $parameter->getClass()->name;
// 检查参数是否为模型的实例
if (is_subclass_of($className, 'Phalcon\Mvc\Model')) {
$model = $className::findFirstById($dispatcher->getParams()[0]);
// 根据模型实例重写参数
$dispatcher->setParams(array($model));
}
}
} catch (\Exception $e) {
// 异常触发,类或者动作不存在?
}
});
$dispatcher = new MvcDispatcher();
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});
~~~
上面示例出于学术目的已经作了简化。开发人员可以在执行动作前注入任何类型的依赖或者模型,以进行提高和强化。
### 处理 Not-Found 错误(Handling Not-Found Exceptions)[](# "永久链接至标题")
使用 [*EventsManager*](#) ,可以在调度器找不到对应的控制器/动作组时而抛出异常前,插入一个钩子:
~~~
<?php
use Phalcon\Dispatcher,
Phalcon\Mvc\Dispatcher as MvcDispatcher,
Phalcon\Events\Manager as EventsManager,
Phalcon\Mvc\Dispatcher\Exception as DispatchException;
$di->set('dispatcher', function () {
// 创建一个事件管理
$eventsManager = new EventsManager();
// 附上一个侦听者
$eventsManager->attach("dispatch:beforeException", function ($event, $dispatcher, $exception) {
// 处理404异常
if ($exception instanceof DispatchException) {
$dispatcher->forward(array(
'controller' => 'index',
'action' => 'show404'
));
return false;
}
// 代替控制器或者动作不存在时的路径
if ($event->getType() == 'beforeException') {
switch ($exception->getCode()) {
case \Phalcon\Dispatcher::EXCEPTION_HANDLER_NOT_FOUND:
case \Phalcon\Dispatcher::EXCEPTION_ACTION_NOT_FOUND:
$dispatcher->forward(array(
'controller' => 'index',
'action' => 'show404'
));
return false;
}
}
});
$dispatcher = new \Phalcon\Mvc\Dispatcher();
// 将EventsManager绑定到调度器
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
}, true);
~~~
当然,这个方法也可以移至独立的插件类中,使得在循环调度产生异常时可以有超过一个类执行需要的动作:
~~~
<?php
use Phalcon\Mvc\Dispatcher,
Phalcon\Events\Event,
Phalcon\Mvc\Dispatcher\Exception as DispatchException;
class ExceptionsPlugin
{
public function beforeException(Event $event, Dispatcher $dispatcher, $exception)
{
// 处理404异常
if ($exception instanceof DispatchException) {
$dispatcher->forward(array(
'controller' => 'index',
'action' => 'show404'
));
return false;
}
// 处理其他异常
$dispatcher->forward(array(
'controller' => 'index',
'action' => 'show503'
));
return false;
}
}
~~~
> 仅仅当异常产生于调度器或者异常产生于被执行的动作时才会通知'beforeException'里面的事件。侦听者或者控制器事件中产生的异常则会重定向到最近的try/catch。
### 自定义调度器(Implementing your own Dispatcher)[](# "永久链接至标题")
为了创建自定义调度器,必须实现 [*Phalcon\Mvc\DispatcherInterface*](#) 接口,从而替换Phalcon框架默认提供的调度器。
|
- [索引](# "总目录")
- [下一页](# "微应用(Micro Applications)") |
- [上一页](# "路由(Routing)") |
- Phalcon 2.0.6文档
- API参考
- API列表
- Abstract class Phalcon\Acl
- Abstract class Phalcon\Acl\Adapter
- Class Phalcon\Acl\Adapter\Memory
- Interface Phalcon\Acl\AdapterInterface
- Class Phalcon\Acl\Exception
- Class Phalcon\Acl\Resource
- Interface Phalcon\Acl\ResourceInterface
- Class Phalcon\Acl\Role
- Interface Phalcon\Acl\RoleInterface
- Class Phalcon\Annotations\Annotation
- Abstract class Phalcon\Annotations\Adapter
- Class Phalcon\Annotations\Adapter\Apc
- Class Phalcon\Annotations\Adapter\Files
- Class Phalcon\Annotations\Adapter\Memory
- Class Phalcon\Annotations\Adapter\Xcache
- Interface Phalcon\Annotations\AdapterInterface
- Class Phalcon\Annotations\Collection
- Class Phalcon\Annotations\Exception
- Class Phalcon\Annotations\Reader
- Interface Phalcon\Annotations\ReaderInterface
- Class Phalcon\Annotations\Reflection
- Class Phalcon\Assets\Collection
- Class Phalcon\Assets\Exception
- Interface Phalcon\Assets\FilterInterface
- Class Phalcon\Assets\Filters\Cssmin
- Class Phalcon\Assets\Filters\Jsmin
- Class Phalcon\Assets\Filters\None
- Class Phalcon\Assets\Inline
- Class Phalcon\Assets\Inline\Css
- Class Phalcon\Assets\Inline\Js
- Class Phalcon\Assets\Manager
- Class Phalcon\Assets\Resource
- Class Phalcon\Assets\Resource\Css
- Class Phalcon\Assets\Resource\Js
- Abstract class Phalcon\Cache\Backend
- Class Phalcon\Cache\Backend\Apc
- Class Phalcon\Cache\Backend\File
- Class Phalcon\Cache\Backend\Libmemcached
- Class Phalcon\Cache\Backend\Memcache
- Class Phalcon\Cache\Backend\Memory
- Class Phalcon\Cache\Backend\Mongo
- Class Phalcon\Cache\Backend\Redis
- Class Phalcon\Cache\Backend\Xcache
- Interface Phalcon\Cache\BackendInterface
- Class Phalcon\Cache\Exception
- Class Phalcon\Cache\Frontend\Base64
- Class Phalcon\Cache\Frontend\Data
- Class Phalcon\Cache\Frontend\Igbinary
- Class Phalcon\Cache\Frontend\Json
- Class Phalcon\Cache\Frontend\None
- Class Phalcon\Cache\Frontend\Output
- Interface Phalcon\Cache\FrontendInterface
- Class Phalcon\Cache\Multiple
- Class Phalcon\Cli\Router\Route
- Class Phalcon\Config
- Class Phalcon\Config\Adapter\Ini
- Class Phalcon\Config\Adapter\Json
- Class Phalcon\Config\Adapter\Php
- Class Phalcon\Config\Adapter\Yaml
- Class Phalcon\Config\Exception
- Class Phalcon\Crypt
- Class Phalcon\Crypt\Exception
- Interface Phalcon\CryptInterface
- Abstract class Phalcon\Db
- Abstract class Phalcon\Db\Adapter
- Abstract class Phalcon\Db\Adapter\Pdo
- Class Phalcon\Db\Adapter\Pdo\Mysql
- Class Phalcon\Db\Adapter\Pdo\Oracle
- Class Phalcon\Db\Adapter\Pdo\Postgresql
- Class Phalcon\Db\Adapter\Pdo\Sqlite
- Interface Phalcon\Db\AdapterInterface
- Class Phalcon\Db\Column
- Interface Phalcon\Db\ColumnInterface
- Abstract class Phalcon\Db\Dialect
- Class Phalcon\Db\Dialect\Oracle
- Class Phalcon\Db\Dialect\Postgresql
- Class Phalcon\Db\Dialect\Sqlite
- Interface Phalcon\Db\DialectInterface
- Class Phalcon\Db\Exception
- Class Phalcon\Db\Index
- Interface Phalcon\Db\IndexInterface
- Class Phalcon\Db\Profiler
- Class Phalcon\Db\Profiler\Item
- Class Phalcon\Db\RawValue
- Class Phalcon\Db\Reference
- Interface Phalcon\Db\ReferenceInterface
- Class Phalcon\Db\Result\Pdo
- Interface Phalcon\Db\ResultInterface
- Class Phalcon\Debug
- Class Phalcon\Debug\Dump
- Class Phalcon\Debug\Exception
- Interface Phalcon\DiInterface
- Abstract class Phalcon\Dispatcher
- Interface Phalcon\DispatcherInterface
- Class Phalcon\Escaper
- Class Phalcon\Escaper\Exception
- Interface Phalcon\EscaperInterface
- Class Phalcon\Events\Event
- Interface Phalcon\Events\EventsAwareInterface
- Class Phalcon\Events\Exception
- Class Phalcon\Events\Manager
- Interface Phalcon\Events\ManagerInterface
- Class Phalcon\Exception
- Class Phalcon\Filter
- Class Phalcon\Filter\Exception
- Interface Phalcon\Filter\UserFilterInterface
- Interface Phalcon\FilterInterface
- Abstract class Phalcon\Flash
- Class Phalcon\Flash\Direct
- Class Phalcon\Flash\Exception
- Class Phalcon\Flash\Session
- Interface Phalcon\FlashInterface
- Class Phalcon\Forms\Form
- Abstract class Phalcon\Forms\Element
- Class Phalcon\Forms\Element\Check
- Class Phalcon\Forms\Element\Email
- Class Phalcon\Forms\Element\File
- Class Phalcon\Forms\Element\Date
- Class Phalcon\Forms\Element\Hidden
- Class Phalcon\Forms\Element\Numeric
- Class Phalcon\Forms\Element\Password
- Class Phalcon\Forms\Element\Radio
- Class Phalcon\Forms\Element\Select
- Class Phalcon\Forms\Element\Submit
- Class Phalcon\Forms\Element\Text
- Class Phalcon\Forms\Element\TextArea
- Interface Phalcon\Forms\ElementInterface
- Class Phalcon\Forms\Exception
- Class Phalcon\Forms\Manager
- Class Phalcon\Http\Cookie
- Class Phalcon\Http\Cookie\Exception
- Class Phalcon\Http\Request
- Class Phalcon\Http\Request\Exception
- Class Phalcon\Http\Request\File
- Interface Phalcon\Http\Request\FileInterface
- Interface Phalcon\Http\RequestInterface
- Class Phalcon\Http\Response
- Class Phalcon\Http\Response\Cookies
- Interface Phalcon\Http\Response\CookiesInterface
- Class Phalcon\Http\Response\Exception
- Class Phalcon\Http\Response\Headers
- Interface Phalcon\Http\Response\HeadersInterface
- Interface Phalcon\Http\ResponseInterface
- Class Phalcon\Image
- Abstract class Phalcon\Image\Adapter
- Class Phalcon\Image\Adapter\Imagick
- Interface Phalcon\Image\AdapterInterface
- Class Phalcon\Image\Exception
- Class Phalcon\Kernel
- Class Phalcon\Loader
- Class Phalcon\Loader\Exception
- Abstract class Phalcon\Logger
- Abstract class Phalcon\Logger\Adapter
- Class Phalcon\Logger\Adapter\File
- Class Phalcon\Logger\Adapter\Firephp
- Class Phalcon\Logger\Adapter\Stream
- Class Phalcon\Logger\Adapter\Syslog
- Interface Phalcon\Logger\AdapterInterface
- Class Phalcon\Logger\Exception
- Abstract class Phalcon\Logger\Formatter
- Class Phalcon\Logger\Formatter\Firephp
- Class Phalcon\Logger\Formatter\Json
- Class Phalcon\Logger\Formatter\Line
- Class Phalcon\Logger\Formatter\Syslog
- Interface Phalcon\Logger\FormatterInterface
- Class Phalcon\Logger\Item
- Class Phalcon\Logger\Multiple
- Class Phalcon\Mvc\Application
- Class Phalcon\Mvc\Application\Exception
- Abstract class Phalcon\Mvc\Collection
- Abstract class Phalcon\Mvc\Collection\Behavior
- Class Phalcon\Mvc\Collection\Behavior\SoftDelete
- Class Phalcon\Mvc\Collection\Behavior\Timestampable
- Interface Phalcon\Mvc\Collection\BehaviorInterface
- Class Phalcon\Mvc\Collection\Document
- Class Phalcon\Mvc\Collection\Exception
- Class Phalcon\Mvc\Collection\Manager
- Interface Phalcon\Mvc\Collection\ManagerInterface
- Interface Phalcon\Mvc\CollectionInterface
- Abstract class Phalcon\Mvc\Controller
- Interface Phalcon\Mvc\ControllerInterface
- Class Phalcon\Mvc\Dispatcher
- Class Phalcon\Mvc\Dispatcher\Exception
- Interface Phalcon\Mvc\DispatcherInterface
- Interface Phalcon\Mvc\EntityInterface
- Class Phalcon\Mvc\Micro
- Class Phalcon\Mvc\Micro\Collection
- Interface Phalcon\Mvc\Micro\CollectionInterface
- Class Phalcon\Mvc\Micro\Exception
- Class Phalcon\Mvc\Micro\LazyLoader
- Interface Phalcon\Mvc\Micro\MiddlewareInterface
- Abstract class Phalcon\Mvc\Model
- Abstract class Phalcon\Mvc\Model\Behavior
- Class Phalcon\Mvc\Model\Behavior\SoftDelete
- Class Phalcon\Mvc\Model\Behavior\Timestampable
- Interface Phalcon\Mvc\Model\BehaviorInterface
- Class Phalcon\Mvc\Model\Criteria
- Interface Phalcon\Mvc\Model\CriteriaInterface
- Class Phalcon\Mvc\Model\Exception
- Class Phalcon\Mvc\Model\Manager
- Interface Phalcon\Mvc\Model\ManagerInterface
- Class Phalcon\Mvc\Model\Message
- Interface Phalcon\Mvc\Model\MessageInterface
- Abstract class Phalcon\Mvc\Model\MetaData
- Class Phalcon\Mvc\Model\MetaData\Apc
- Class Phalcon\Mvc\Model\MetaData\Files
- Class Phalcon\Mvc\Model\MetaData\Libmemcached
- Class Phalcon\Mvc\Model\MetaData\Memcache
- Class Phalcon\Mvc\Model\MetaData\Memory
- Class Phalcon\Mvc\Model\MetaData\Session
- Class Phalcon\Mvc\Model\MetaData\Strategy\Annotations
- Class Phalcon\Mvc\Model\MetaData\Strategy\Introspection
- Interface Phalcon\Mvc\Model\MetaData\StrategyInterface
- Class Phalcon\Mvc\Model\MetaData\Xcache
- Interface Phalcon\Mvc\Model\MetaDataInterface
- Class Phalcon\Mvc\Model\Query
- Class Phalcon\Mvc\Model\Query\Builder
- Interface Phalcon\Mvc\Model\Query\BuilderInterface
- Abstract class Phalcon\Mvc\Model\Query\Lang
- Class Phalcon\Mvc\Model\Query\Status
- Interface Phalcon\Mvc\Model\Query\StatusInterface
- Interface Phalcon\Mvc\Model\QueryInterface
- Class Phalcon\Mvc\Model\Relation
- Interface Phalcon\Mvc\Model\RelationInterface
- Interface Phalcon\Mvc\Model\ResultInterface
- Abstract class Phalcon\Mvc\Model\Resultset
- Class Phalcon\Mvc\Model\Resultset\Complex
- Class Phalcon\Mvc\Model\Resultset\Simple
- Abstract class Phalcon\Mvc\Model\Validator
- Class Phalcon\Mvc\Model\Validator\Email
- Class Phalcon\Mvc\Model\Validator\Exclusionin
- Class Phalcon\Mvc\Model\Validator\Inclusionin
- Class Phalcon\Mvc\Model\Validator\Ip
- Class Phalcon\Mvc\Model\Validator\Numericality
- Class Phalcon\Mvc\Model\Validator\PresenceOf
- Class Phalcon\Mvc\Model\Validator\Regex
- Class Phalcon\Mvc\Model\Validator\StringLength
- Class Phalcon\Mvc\Model\Validator\Uniqueness
- Class Phalcon\Mvc\Model\Validator\Url
- Interface Phalcon\Mvc\Model\ValidatorInterface
- Interface Phalcon\Mvc\Model\ResultsetInterface
- Class Phalcon\Mvc\Model\Row
- Class Phalcon\Mvc\Model\Transaction
- Class Phalcon\Mvc\Model\Transaction\Exception
- Class Phalcon\Mvc\Model\Transaction\Failed
- Class Phalcon\Mvc\Model\Transaction\Manager
- Interface Phalcon\Mvc\Model\Transaction\ManagerInterface
- Interface Phalcon\Mvc\Model\TransactionInterface
- Class Phalcon\Mvc\Model\ValidationFailed
- Interface Phalcon\Mvc\ModelInterface
- Interface Phalcon\Mvc\ModuleDefinitionInterface
- Class Phalcon\Mvc\Router
- Class Phalcon\Mvc\Router\Annotations
- Class Phalcon\Mvc\Router\Exception
- Class Phalcon\Mvc\Router\Group
- Interface Phalcon\Mvc\Router\GroupInterface
- Class Phalcon\Mvc\Router\Route
- Interface Phalcon\Mvc\Router\RouteInterface
- Interface Phalcon\Mvc\RouterInterface
- Class Phalcon\Mvc\Url
- Class Phalcon\Mvc\Url\Exception
- Interface Phalcon\Mvc\UrlInterface
- Class Phalcon\Mvc\User\Component
- Class Phalcon\Mvc\User\Module
- Class Phalcon\Mvc\User\Plugin
- Class Phalcon\Mvc\View
- Abstract class Phalcon\Mvc\View\Engine
- Class Phalcon\Mvc\View\Engine\Php
- Class Phalcon\Mvc\View\Engine\Volt
- Class Phalcon\Mvc\View\Engine\Volt\Compiler
- Interface Phalcon\Mvc\View\EngineInterface
- Class Phalcon\Mvc\View\Exception
- Class Phalcon\Mvc\View\Simple
- Interface Phalcon\Mvc\ViewBaseInterface
- Interface Phalcon\Mvc\ViewInterface
- Abstract class Phalcon\Paginator\Adapter
- Class Phalcon\Paginator\Adapter\Model
- Class Phalcon\Paginator\Adapter\NativeArray
- Class Phalcon\Paginator\Adapter\QueryBuilder
- Interface Phalcon\Paginator\AdapterInterface
- Class Phalcon\Paginator\Exception
- Class Phalcon\Queue\Beanstalk
- Class Phalcon\Queue\Beanstalk\Job
- Final class Phalcon\Registry
- Class Phalcon\Security
- Class Phalcon\Security\Exception
- Abstract class Phalcon\Session
- Abstract class Phalcon\Session\Adapter
- Class Phalcon\Session\Adapter\Files
- Class Phalcon\Session\Adapter\Libmemcached
- Class Phalcon\Session\Adapter\Memcache
- Interface Phalcon\Session\AdapterInterface
- Class Phalcon\Session\Bag
- Interface Phalcon\Session\BagInterface
- Class Phalcon\Session\Exception
- Class Phalcon\Tag
- Class Phalcon\Tag\Exception
- Abstract class Phalcon\Tag\Select
- Abstract class Phalcon\Text
- Abstract class Phalcon\Translate
- Abstract class Phalcon\Translate\Adapter
- Class Phalcon\Translate\Adapter\Csv
- Class Phalcon\Translate\Adapter\Gettext
- Class Phalcon\Translate\Adapter\NativeArray
- Interface Phalcon\Translate\AdapterInterface
- Class Phalcon\Translate\Exception
- Class Phalcon\Validation
- Class Phalcon\Validation\Exception
- Class Phalcon\Validation\Message
- Class Phalcon\Validation\Message\Group
- Interface Phalcon\Validation\MessageInterface
- Abstract class Phalcon\Validation\Validator
- Class Phalcon\Validation\Validator\Alnum
- Class Phalcon\Validation\Validator\Alpha
- Class Phalcon\Validation\Validator\Between
- Class Phalcon\Validation\Validator\Confirmation
- Class Phalcon\Validation\Validator\Digit
- Class Phalcon\Validation\Validator\Email
- Class Phalcon\Validation\Validator\ExclusionIn
- Class Phalcon\Validation\Validator\File
- Class Phalcon\Validation\Validator\Identical
- Class Phalcon\Validation\Validator\InclusionIn
- Class Phalcon\Validation\Validator\Numericality
- Class Phalcon\Validation\Validator\PresenceOf
- Class Phalcon\Validation\Validator\Regex
- Class Phalcon\Validation\Validator\StringLength
- Class Phalcon\Validation\Validator\Uniqueness
- Class Phalcon\Validation\Validator\Url
- Interface Phalcon\Validation\ValidatorInterface
- Class Phalcon\Version
- 参考手册
- 安装(Installation)
- 教程 1:让我们通过例子来学习(Tutorial 1: Let’s learn by example)
- 教程 2:Introducing INVO(Tutorial 2: Introducing INVO)
- 教程 3: Securing INVO
- 教程 4: Using CRUDs
- 教程 5: Customizing INVO
- 教程 6: Vkuró
- 教程 7:创建简单的 REST API(Tutorial 7: Creating a Simple REST API)
- 示例列表(List of examples)
- 依赖注入与服务定位器(Dependency Injection/Service Location)
- MVC 架构(The MVC Architecture)
- 使用控制器(Using Controllers)
- 使用模型(Working with Models)
- 模型元数据(Models Meta-Data)
- 事务管理(Model Transactions)
- Phalcon 查询语言(Phalcon Query Language (PHQL))
- 缓存对象关系映射(Caching in the ORM)
- 对象文档映射 ODM (Object-Document Mapper)
- 使用视图(Using Views)
- 视图助手(View Helpers)
- 资源文件管理(Assets Management)
- Volt 模版引擎(Volt: Template Engine)
- MVC 应用(MVC Applications)
- 路由(Routing)
- 调度控制器(Dispatching Controllers)
- 微应用(Micro Applications)
- 使用命名空间(Working with Namespaces)
- 事件管理器(Events Manager)
- Request Environment
- 返回响应(Returning Responses)
- Cookie 管理(Cookies Management)
- 生成 URL 和 路径(Generating URLs and Paths)
- 闪存消息(Flashing Messages)
- 使用 Session 存储数据(Storing data in Session)
- 过滤与清理(Filtering and Sanitizing)
- 上下文编码(Contextual Escaping)
- 验证(Validation)
- 表单(Forms)
- 读取配置(Reading Configurations)
- 分页(Pagination)
- 使用缓存提高性能(Improving Performance with Cache)
- 安全(Security)
- Encryption/Decryption
- 访问控制列表 ACL(Access Control Lists ACL)
- 多语言支持(Multi-lingual Support)
- Universal Class Loader
- 日志记录(Logging)
- 注释解析器(Annotations Parser)
- 命令行应用(Command Line Applications)
- 队列(Queueing)
- 数据库抽象层(Database Abstraction Layer)
- 国际化(Internationalization)
- 数据库迁移(Database Migrations)
- 调试应用程序(Debugging Applications)
- Phalcon 开发工具(Phalcon Developer Tools)
- 提高性能:下一步该做什么?(Increasing Performance: What’s next?)
- 单元测试(Unit testing)
- 授权(License)