# 表單(Forms)
# 表單(Forms)
Phalcon中提供了 Phalcon\\Forms組件以方便開發者創建和維護應用中的表單。
下面的例子中展示了基本的使用方法:
```
<pre class="calibre14">```
<?php
use Phalcon\Forms\Form;
use Phalcon\Forms\Element\Text;
use Phalcon\Forms\Element\Select;
$form = new Form();
$form->add(new Text("name"));
$form->add(new Text("telephone"));
$form->add(
new Select(
"telephoneType",
array(
'H' => 'Home',
'C' => 'Cell'
)
)
);
```
```
可在表單定義時穿插使用表單元素的字義:
```
<pre class="calibre14">```
<h1>Contacts</h1>
<form method="post">
<p>
<label>Name</label>
<?php echo $form->render("name"); ?>
</p>
<p>
<label>Telephone</label>
<?php echo $form->render("telephone"); ?>
</p>
<p>
<label>Type</label>
<?php echo $form->render("telephoneType"); ?>
</p>
<p>
<input type="submit" value="Save" />
</p>
</form>
```
```
開發者可根據需要渲染HTML組件。 當使用render()函數時, phalcon內部會使用 [*Phalcon\\Tag*](#) 生成相應的html項,第二個參數中可以對一些屬性進行設置。
```
<pre class="calibre14">```
<p>
<label>Name</label>
<?php echo $form->render("name", array('maxlength' => 30, 'placeholder' => 'Type your name')); ?>
</p>
```
```
HTML的屬性也可以在創建時指定:
```
<pre class="calibre14">```
<?php
$form->add(
new Text(
"name",
array(
'maxlength' => 30,
'placeholder' => 'Type your name'
)
)
);
```
```
### 初始化表單(Initializing forms)
從上面的例子我們可以看到表單項也可以在form對象初始化后進行添加。 當然開發者也可以對原有的Form類進行擴展:
```
<pre class="calibre14">```
<?php
use Phalcon\Forms\Form;
use Phalcon\Forms\Element\Text;
use Phalcon\Forms\Element\Select;
class ContactForm extends Form
{
public function initialize()
{
$this->add(new Text("name"));
$this->add(new Text("telephone"));
$this->add(
new Select(
"telephoneType",
TelephoneTypes::find(),
array(
'using' => array(
'id',
'name'
)
)
)
);
}
}
```
```
由于 [*Phalcon\\Forms\\Form*](#) 實現了 [*Phalcon\\DI\\Injectable*](#) 接口,所以開發者可以根據自己的需要訪問應用中的服務。
```
<pre class="calibre14">```
<?php
use Phalcon\Forms\Form;
use Phalcon\Forms\Element\Text;
use Phalcon\Forms\Element\Hidden;
class ContactForm extends Form
{
/**
* This method returns the default value for field 'csrf'
*/
public function getCsrf()
{
return $this->security->getToken();
}
public function initialize()
{
// Set the same form as entity
$this->setEntity($this);
// Add a text element to capture the 'email'
$this->add(new Text("email"));
// Add a text element to put a hidden csrf
$this->add(new Hidden("csrf"));
}
}
```
```
相關的實體在初始化時添加到表單, 自定義的選項通過構造器傳送:
```
<pre class="calibre14">```
<?php
use Phalcon\Forms\Form;
use Phalcon\Forms\Element\Text;
use Phalcon\Forms\Element\Hidden;
class UsersForm extends Form
{
/**
* Forms initializer
*
* @param Users $user
* @param array $options
*/
public function initialize($user, $options)
{
if ($options['edit']) {
$this->add(new Hidden('id'));
} else {
$this->add(new Text('id'));
}
$this->add(new Text('name'));
}
}
```
```
在表單實例中必須要這樣使用:
```
<pre class="calibre14">```
<?php
$form = new UsersForm(
new Users(),
array(
'edit' => true
)
);
```
```
### 驗證(Validation)
Phalcon表單組件可以和 [*validation*](#) 集成,以提供驗證。 開發者要單獨為每個html元素提供內置或自定義的驗證器。
```
<pre class="calibre14">```
<?php
use Phalcon\Forms\Element\Text;
use Phalcon\Validation\Validator\PresenceOf;
use Phalcon\Validation\Validator\StringLength;
$name = new Text("name");
$name->addValidator(
new PresenceOf(
array(
'message' => 'The name is required'
)
)
);
$name->addValidator(
new StringLength(
array(
'min' => 10,
'messageMinimum' => 'The name is too short'
)
)
);
$form->add($name);
```
```
然后, 開發者可以根據用戶的輸入進行驗證:
```
<pre class="calibre14">```
<?php
if (!$form->isValid($_POST)) {
foreach ($form->getMessages() as $message) {
echo $message, '<br>';
}
}
```
```
驗證器執行的順序和注冊的順序一致。
默認情況下,所有的元素產生的消息是放在一起的, 所以開發者可以使用簡單的foreach來遍歷消息, 開發者可以按照自己的意愿組織輸出:
```
<pre class="calibre14">```
<?php
foreach ($form->getMessages(false) as $attribute => $messages) {
echo 'Messages generated by ', $attribute, ':', "\n";
foreach ($messages as $message) {
echo $message, '<br>';
}
}
```
```
或獲取指定元素的消息:
```
<pre class="calibre14">```
<?php
foreach ($form->getMessagesFor('name') as $message) {
echo $message, '<br>';
}
```
```
### 過濾(Filtering)
表單元素可以在進行驗證前先進行過濾, 開發者可以為每個元素設置過濾器:
### 設置用戶選項(Setting User Options)
### 表單與實體(Forms + Entities)
我們可以把 model/collection/plain 設置到表單對象中, 這樣 phalcon 會自動的設置表單元素的值:
```
<pre class="calibre14">```
<?php
$robot = Robots::findFirst();
$form = new Form($robot);
$form->add(new Text("name"));
$form->add(new Text("year"));
```
```
在表單渲染時如果表單項未設置默認值, phalcon會使用對象實體值作為默認值:
```
<pre class="calibre14">```
<?php echo $form->render('name'); ?>
```
```
開發者可以使用下面的方式驗證表單及利用用戶的輸入來設置值:
```
<pre class="calibre14">```
<?php
$form->bind($_POST, $robot);
// Check if the form is valid
if ($form->isValid()) {
// Save the entity
$robot->save();
}
```
```
也可以使用一個簡單的類做為對象實體進行參數傳遞:
```
<pre class="calibre14">```
<?php
class Preferences
{
public $timezone = 'Europe/Amsterdam';
public $receiveEmails = 'No';
}
```
```
使用此類做為對象實體,這樣可以使用此類中的值作為表單的默認值:
```
<pre class="calibre14">```
<?php
$form = new Form(new Preferences());
$form->add(
new Select(
"timezone",
array(
'America/New_York' => 'New York',
'Europe/Amsterdam' => 'Amsterdam',
'America/Sao_Paulo' => 'Sao Paulo',
'Asia/Tokyo' => 'Tokyo'
)
)
);
$form->add(
new Select(
"receiveEmails",
array(
'Yes' => 'Yes, please!',
'No' => 'No, thanks'
)
)
);
```
```
實體中也可以使用getters, 這樣可以給開發者更多的自由, 當然也會洽使開發稍麻煩一些,不過這是值得的:
```
<pre class="calibre14">```
<?php
class Preferences
{
public $timezone;
public $receiveEmails;
public function getTimezone()
{
return 'Europe/Amsterdam';
}
public function getReceiveEmails()
{
return 'No';
}
}
```
```
### 表單控件(Form Elements)
Phalcon提供了一些內置的html元素類, 所有這些元素類僅位于 Phalcon\\Forms\\Element命名空間下:
名稱描述示例Text產生 INPUT\[type=text\] 項[*Example*](#)Password產生 INPUT\[type=password\] 項[*Example*](#)Select產生 SELECT tag (combo lists) 項[*Example*](#)Check產生 INPUT\[type=check\] 項[*Example*](#)Textarea產生 TEXTAREA 項[*Example*](#)Hidden產生 INPUT\[type=hidden\] 項[*Example*](#)File產生 INPUT\[type=file\] 項[*Example*](#)Date產生 INPUT\[type=date\] 項[*Example*](#)Numeric產生 INPUT\[type=number\] 項[*Example*](#)Submit產生 INPUT\[type=submit\] 項[*Example*](#)### 事件回調(Event Callbacks)
當擴展表單時, 我們可以在表單類中實現驗證前操作及驗證后操作:
```
<pre class="calibre14">```
<?php
use Phalcon\Mvc\Form;
class ContactForm extends Form
{
public function beforeValidation()
{
}
}
```
```
### 渲染表單(Rendering Forms)
開發者對表單的渲染操作有完全的控制, 下面的的例子展示了如何使用標準方法渲染html元素:
```
<pre class="calibre14">```
<?php
<form method="post">
<?php
// Traverse the form
foreach ($form as $element) {
// Get any generated messages for the current element
$messages = $form->getMessagesFor($element->getName());
if (count($messages)) {
// Print each element
echo '<div class="messages">';
foreach ($messages as $message) {
echo $message;
}
echo '</div>';
}
echo '<p>';
echo '<label for="', $element->getName(), '">', $element->getLabel(), '</label>';
echo $element;
echo '</p>';
}
?>
<input type="submit" value="Send"/>
</form>
```
```
或是在登錄表單中重用表單類:
```
<pre class="calibre14">```
<?php
use Phalcon\Forms\Form;
class ContactForm extends Form
{
public function initialize()
{
// ...
}
public function renderDecorated($name)
{
$element = $this->get($name);
// Get any generated messages for the current element
$messages = $this->getMessagesFor($element->getName());
if (count($messages)) {
// Print each element
echo '<div class="messages">';
foreach ($messages as $message) {
echo $this->flash->error($message);
}
echo '</div>';
}
echo '<p>';
echo '<label for="', $element->getName(), '">', $element->getLabel(), '</label>';
echo $element;
echo '</p>';
}
}
```
```
視圖中:
```
<pre class="calibre14">```
<?php
echo $element->renderDecorated('name');
echo $element->renderDecorated('telephone');
```
```
### 創建表單控件(Creating Form Elements)
除了可以使用phalcon提供的html元素以外, 開發者還可以使用自定義的html元素:
```
<pre class="calibre14">```
<?php
use Phalcon\Forms\Element;
class MyElement extends Element
{
public function render($attributes = null)
{
$html = // ... Produce some HTML
return $html;
}
}
```
```
### 表單管理(Forms Manager)
此組件為開發者提供了一個表單管理器, 可以用來注冊表單,此組件可以使用服務容器來訪問:
```
<pre class="calibre14">```
<?php
use Phalcon\Forms\Manager as FormsManager;
$di['forms'] = function () {
return new FormsManager();
};
```
```
表單被添加到表單管理器, 然后設置了唯一的名字:
```
<pre class="calibre14">```
<?php
$this->forms->set('login', new LoginForm());
```
```
使用唯一名, 我們可以在應用的任何地方訪問到表單:
```
<pre class="calibre14">```
<?php
echo $this->forms->get('login')->render();
```
```
### 外部資源(External Resources)
- [Vkuró](http://vokuro.phalconphp.com) 是一個使用表單構建器來創建和維護表單的示例 \[[Github](https://github.com/phalcon/vokuro)\]
|
- [索引](# "總目錄")
- [下一頁](# "讀取配置(Reading Configurations)") |
- [上一頁](# "驗證(Validation)") |
- 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
- 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
- Interface Phalcon\Db\AdapterInterface
- Class Phalcon\Db\Column
- Interface Phalcon\Db\ColumnInterface
- Abstract class Phalcon\Db\Dialect
- Interface Phalcon\Db\DialectInterface
- Class Phalcon\Db\Exception
- Class Phalcon\Db\Index
- Interface Phalcon\Db\IndexInterface
- Class Phalcon\Db\Profiler
- 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\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
- 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\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
- Interface Phalcon\Mvc\Model\MetaDataInterface
- Class Phalcon\Mvc\Model\Query
- 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
- Abstract class Phalcon\Mvc\Model\Validator
- Interface Phalcon\Mvc\Model\ResultsetInterface
- Class Phalcon\Mvc\Model\Row
- Class Phalcon\Mvc\Model\Transaction
- 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
- 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
- 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)