zoukankan      html  css  js  c++  java
  • CI框架

    安装Xhprof参考:http://www.cnblogs.com/qq917937712/p/8889001.html

    第一步:配置config.php

    $config['enable_hooks'] = TRUE;

    第二步:配置钩子

    ci钩子使用手册:http://codeigniter.org.cn/user_guide/general/hooks.html

    $hook['pre_controller'] = array(
        'class'    => 'Xhprof',
        'function' => 'start',
        'filename' => 'Xhprof.php',
        'filepath' => 'hooks',
        'params'   => array()
    );
    
    
    $hook['display_override'] = array(
        'class'    => 'Xhprof',
        'function' => 'end',
        'filename' => 'Xhprof.php',
        'filepath' => 'hooks',
        'params'   => array()
    );

    第三步:钩子具体代码

    class Xhprof
    {
        /**
         * 监控开始
         */
        public function start()
        {
            xhprof_enable();
        }
    
        /**
         * 监控结束
         */
        public function end()
        {
            // stop profiler
            $xhprof_data = xhprof_disable();
            $XHPROF_ROOT = realpath(dirname(__FILE__) . '/../../../xhprof-0.9.4');
            include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php";
            include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php";
            $xhprof_runs = new XHProfRuns_Default();
            $id = $xhprof_runs->save_run($xhprof_data, 'newdefend');
            //$CI =& get_instance();
            echo "<a href='http://localhost/xhprof-0.9.4/xhprof_html/index.php?run=" . $id . "&source=newdefend' target=_blank>查看监控</a>";
        }
    }
  • 相关阅读:
    js对象深拷贝
    数组去重
    css布局之双飞翼布局
    css布局之圣杯布局
    在浏览器中输入URL并回车后都发生了什么?
    浮动和清除浮动
    Javascript 构造函数模式、原型模式
    Javascript之对象组合继承
    js可以随意拖拽的div的实现
    博客美化 之博客的魔方效果
  • 原文地址:https://www.cnblogs.com/qq917937712/p/8889433.html
Copyright © 2011-2022 走看看