當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Profiler::mark_memory方法代碼示例

本文整理匯總了PHP中Profiler::mark_memory方法的典型用法代碼示例。如果您正苦於以下問題:PHP Profiler::mark_memory方法的具體用法?PHP Profiler::mark_memory怎麽用?PHP Profiler::mark_memory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Profiler的用法示例。


在下文中一共展示了Profiler::mark_memory方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: action_index

 /**
  *  Load every call to the API with this method.
  *  
  *  @return void
  *  @access public
  */
 public function action_index()
 {
     // Profile the loader
     \Profiler::mark('Start of loader\'s action_index() function');
     \Profiler::mark_memory($this, 'Start of loader\'s action_index() function');
     // Make sure we aren't processing crap.
     if (in_array($this->format, array('csv', 'php', 'serialize'))) {
         $this->format = 'json';
     }
     // For some reason this value is quoted when set to html.
     if (\Input::post('format') === '"html"') {
         $this->format = 'html';
     }
     // Cleanse the session to keep things stable.
     \Session::destroy();
     // For error handling
     \Session::set('response_format', $this->format);
     // External error processing through Apache
     if (\Uri::segment(1) === 'error' && is_numeric(\Uri::segment(2)) && strlen(\Uri::segment(2)) === 3) {
         return $this->response(\Utility::format_error(\Uri::segment(2)));
     }
     // /loader/index/error/404 style (Due to routing)
     if (substr_count(\Uri::current(), 'loader/index/error') === 1 && is_numeric(\Uri::segment(4)) && strlen(\Uri::segment(4)) === 3) {
         return $this->response(\Utility::format_error(\Uri::segment(4)));
     }
     // We need a version number
     if (empty(\Uri::segment(1)) || \Module::exists(\Uri::segment(1)) === false) {
         $error_data = \Utility::format_error(400, \Err::BAD_OR_NO_VERSION, \Lang::get('errors.bad_version'));
         return $this->response($error_data, 400);
     }
     // We need a request.
     if (empty(\Input::post()) || \Input::method() !== 'POST') {
         $error_data = \Utility::format_error(405, null, \Lang::get('errors.no_request'));
         return $this->response($error_data, 405);
     }
     // Pass the request to the proper API version request handler. (Module)
     if (!empty(\Input::post())) {
         \Module::load(\Uri::segment(1));
         $response = \Request::forge(\Uri::segment(1) . '/index', false)->execute()->response->body;
         // HTML only Data Calls
         if (is_string($response)) {
             return $this->response($response, 200);
         }
         return $this->response($response[0], $response[1]);
     }
 }
開發者ID:bitapihub,項目名稱:api-optimization-engine,代碼行數:52,代碼來源:loader.php


注:本文中的Profiler::mark_memory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。