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>";
        }
    }
  • 相关阅读:
    变量与作用域
    安装node和grunt
    神奇的万维网
    大小写字母的转换
    跨域的方法
    选择器中含有空格的注意事项
    Tools
    jquery中innerWidth(),outerWidth(),outerWidth(true)和width()的区别
    网页中的foot底部定位问题
    CSS hack
  • 原文地址:https://www.cnblogs.com/qq917937712/p/8889433.html
Copyright © 2011-2022 走看看