首页 > php教程 > PHP源码 > 正文

PHP 事件驱动程序

PHP中文网
发布: 2016-05-26 08:18:44
原创
1182 人浏览过

1.class.Dispatcher.php

handle=$event_handle;
    }
     
    function handle_the_event(){
        $name="handler_$this->handle";
        if(class_exists("$name")){
            $handler_obj=new $name($this->handle);
            $response=$handler_obj->secure_handler();
            return $response;
        }else{
            echo "I can't handle this!";
        }
    }
}
?>

Secure,Event Driven Record Viewer!
handle_the_event(); } $_SESSION['name']="Wangzy"; if(isset($_POST['event'])) handle(); ?>
登录后复制

2.class.Handler_Event.php

handle=$event_handle;
    }
     
    function handled_event(){
        echo "The event, $this->handle, is now handled.
It is ,I promise!

Your records are as follows:

"; $id=parent::dbconn(); $result=mysql_query("select * from table01",$id); while($row=mysql_fetch_array($result)){ echo "Numbers:".$row['number']."\tName:".$row['name']."
"; } } function secure_handler(){ if($_SESSION['name']=="Wangzy"){ $this->handled_event(); }else{ echo "Sorry {$_SESSION['name']} you are not authorized!"; } } } //Edit Event class Handler_Edit extends Event_Handler{ private $handle; function __construct($event_handle){ $this->handle=$event_handle; } function handled_event(){ echo "This is event $this->handle, which is now handled -no kidding!
"; } function secure_handler(){ $this->handled_event(); } }
登录后复制
相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
作者最新文章
最新问题
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!