• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
{memory_usage} in Codeigniter 4?

#2
It has not been placed into the CI 4 Framework, but looking at CI 3 you should
be able to create a method to do it.

You would need to extend the output class or send it to the output.

PHP Code:
    //--------------------------------------------------------------------

    /**
     * Replaces the memory_usage and elapsed_time tags.
     *
     * @param string $output
     *
     * @return string
     */
    
public function displayPerformanceMetrics(string $output): string
    
{
        
$this->totalTime $this->benchmark->getElapsedTime('total_execution');

 
               $memory round(memory_get_usage() / 1024 10242).'MB';

     
       $output str_replace(array('{elapsed_time}''{memory_usage}'), array($this->totalTime$memory), $output);
        
 
               //$output = str_replace('{elapsed_time}', $this->totalTime, $output);

        
return $output;
    } 

And modify it for something like above. I would create a function and then modify the output.

The CI4 method is in the Codeigniter class.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
{memory_usage} in Codeigniter 4? - by sibiniv - 12-10-2018, 04:43 AM
RE: {memory_usage} in Codeigniter 4? - by InsiteFX - 12-10-2018, 05:26 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.