php - Codeigniter REST API elapsed time -
i'm using codeigniter rest-api (author: philsturgeon ref url:
https://github.com/philsturgeon/codeigniter-restserver)
i want add response how time took service generate , process response.
i trying use $this->benchmark->elapsed_time()
in controller, doesn't send time instead sends
"success": 1,"took": "{elapsed_time}",
i tried edit the main controller of api abstract class rest_controller extends ci_controller
, append elapsed time final output send public function response($data = null, $http_code = null, $continue = false)
but no luck, keep receiving "{elapsed_time}"
appreciated.
you can elapsed_time
using this
$this->benchmark->mark('code_start'); // code happens here $this->benchmark->mark('code_end'); echo $this->benchmark->elapsed_time('code_start', 'code_end');
Comments
Post a Comment