zoukankan      html  css  js  c++  java
  • 初学Phreeze 6,reporter文件

    Phreezer.php里面的函数,
    public function IncludeModel($objectclass) { Includer::RequireClass($objectclass, array("Model/","Reporter/") ); }
    Query()方法里面有这句话
    1 $custom = $this->GetCustomQuery($objectclass, $criteria);

    调用了Phreezer.php里面的自身的方法GetCustomQuery();

    public function GetCustomQuery($objectclass, $criteria)
        {
            $this->IncludeModel($objectclass);
            $sql = call_user_func( array($objectclass,"GetCustomQuery"),$criteria );
    //上面这句话调用了用户自定义的GetCustomQuery方法,在Reporter.php里面
    return $sql; }
     
    PTestReporter.php的内容如下:

    require_once("verysimple/Phreeze/Reporter.php"); class PTestReporter extends Reporter{ public $Id; public $Name; public $Time; static function GetCustomQuery($criteria) { $sql = "select `ptest`.`id` as Id ,`ptest`.`name` as Name ,`ptest`.`time` as Time from `ptest`"; // the criteria can be used or you can write your own custom logic. // be sure to escape any user input with $criteria->Escape() $sql .= $criteria->GetWhere(); $sql .= $criteria->GetOrder();      //echo $sql; return $sql; } }
     */
        public static function RequireClass($classname, $classpath = "")
        {
            if (class_exists($classname)) return true;
            
            // normalize this as an array
            $classpaths = is_array($classpath) ? $classpath : array($classpath);
            $attempts = "";
    
            foreach ($classpaths as $path)
            {
                if (class_exists($classname)) break;
    //$classname='PTest';
    //$classpaths=array('Model/','Reporter/');
    try { // append a directory separater if necessary if ($path && substr($path,-1) != "/") $path .= "/"; Includer::IncludeFile($path . $classname . ".php"); //这里表示加载的页面,可是也没有说明可以加载Reporter.php的文件啊, } catch (IncludeException $ex) {$attempts .= " " . $ex->getMessage();} } if (!class_exists($classname)) { // the class still isn't defined so there was a problem including the model throw new IncludeException("Unable to locate class '$classname': " . $attempts); } }

    Query语句这么写:

    $ds=$this->Phreezer->Query('PTestReporter',$criteria);

    未完待续。。。。。。

  • 相关阅读:
    bug排查
    做接口测试没反应
    wcf配置文件
    mvc学习-编辑提交需要注意-mvc重点
    大批量导出思路
    进程基础知识
    (转)JMS事务
    (转)JMS简明学习教程
    (转)Linux下使用system()函数一定要谨慎
    LInux文件基础知识和文件目录操作(二)文件I/O操作
  • 原文地址:https://www.cnblogs.com/zhangjun516/p/2934975.html
Copyright © 2011-2022 走看看