• Container容器

    Container容器

    Container容器可实现存储事件,变量等.
    在EasySwoole中,pipe通信回调事件使用的就是继承Container容器的存储方式:
    用法示例:

    1. <?php
    2. $container = new \EasySwoole\Component\Container();
    3. $container->set("OnOpen",function (){
    4. echo "onOpen事件回调";
    5. });
    6. $container->set("name",'仙士可');
    7. var_dump($container->all());
    8. call_user_func($container->get("OnOpen"));
    9. $container->delete('name');