Phalcon7(代号Dao7) 发布 1.1.1 版更新

来源:开源中国社区 作者:朱宗鑫1
  

添加抽象类 Phalcon\Mvc\User\Logic,可以设置调度器绑定逻辑类,会根据控制器方法参数自动调用逻辑类静态方法call完成实例化,然后调用start完成初始化操作, 当控制器方法执行结束后,将调用finish方法:

 

<?php

$di->set('dispatcher'function () {
    $dispatcher = new Dispatcher();
    $dispatcher->setLogicBinding(true);
    return $dispatcher;
});

控制器实现:

 

 

<?php

class LogicController extends Phalcon\Mvc\Controller
{
    public function indexAction(\MyLogic $logic)
    {
        // ...
    }
}

添加二进制数据数据读取、写入类 Phalcon\Binary\Reader和Phalcon\Binary\Writer:

 

 

<?php

$fp = fopen('test.bin''rb');

$bin = new Phalcon\Binary\Reader($fp);
$flag = $bin->readUnsignedChar();
$num = $bin->readUnsignedInt16();
$name = $bin->readString();


$fp = fopen('test.bin''wb');

$bin = new Phalcon\Binary\Write($fp);
$bin->writeUnsignedChar(1);
$bin->writeUnsignedInt16(240);
$bin->writeString('Phalcon7');

以及修复了一些发现的BUG和改进了表单类。


时间:2016-11-12 22:09 来源:开源中国社区 作者:朱宗鑫1 原文链接

好文,顶一下
(0)
0%
文章真差,踩一下
(0)
0%
------分隔线----------------------------


把开源带在你的身边-精美linux小纪念品
无觅相关文章插件,快速提升流量