{elapsed_time}&{Imniter中的{memory_usage}伪变量 [英] {elapsed_time} & {memory_usage} pseudo-variable in CodeIgniter

查看:53
本文介绍了{elapsed_time}&{Imniter中的{memory_usage}伪变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能解释{elapsed_time}&CodeIgniter中的{memory_usage}伪变量?这指的是什么模板?

Could anyone explain {elapsed_time} & {memory_usage} pseudo-variables in CodeIgniter? What template is this referring to?

在Benchmark.php中

In Benchmark.php

/**
 * Memory Usage
 *
 * This function returns the {memory_usage} pseudo-variable.
 * This permits it to be put it anywhere in a template
 * without the memory being calculated until the end.
 * The output class will swap the real value for this variable.
 *
 * @access  public
 * @return  string
 */
function memory_usage()
{
    return '{memory_usage}';
}

谢谢

推荐答案

这些变量来自Benchmarking类.

Those variables are from the Benchmarking class.

引用官方文档:

{elapsed_time}

显示从CodeIgniter开始到将最终输出发送到浏览器之间的总时间

display the total elapsed time from the moment CodeIgniter starts to the moment the final output is sent to the browser

{memory_usage}

消耗量将反映整个应用程序使用的总内存

The consumption will reflect the total memory used by the entire app

在此处查看其工作方式: http://www.codeigniter.com/user_guide/libraries/benchmark.html

See how it works here : http://www.codeigniter.com/user_guide/libraries/benchmark.html

此类的一种用法是检查代码块:

One use of this class is checking blocks of code :

public function myfunction()
{
    //Stuff here

    $this->benchmark->mark('start');

    //Stuff suspected to be slow

    $this->benchmark->mark('end');

    echo $this->benchmark->elapsed_time('start', 'end');
}

这篇关于{elapsed_time}&{Imniter中的{memory_usage}伪变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆