当前位置: 首页>>代码示例>>PHP>>正文


PHP Exception::trigger_error方法代码示例

本文整理汇总了PHP中Exception::trigger_error方法的典型用法代码示例。如果您正苦于以下问题:PHP Exception::trigger_error方法的具体用法?PHP Exception::trigger_error怎么用?PHP Exception::trigger_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Exception的用法示例。


在下文中一共展示了Exception::trigger_error方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute($args)
 {
     $arguments = func_get_args();
     $callback = $arguments[0];
     if (!is_callable($callback)) {
         Exception::trigger_error('First argument is expected to be a valid callback', E_USER_WARNING);
     }
     array_shift($arguments);
     return call_user_func_array($callback, $arguments);
 }
开发者ID:zhangjingpu,项目名称:yaf-lib,代码行数:10,代码来源:Application.php

示例2: dispatch

 /**
  * Dispatch an HTTP request to a controller/action.
  *
  * @param Yaf_Request_Abstract|null $request
  * @return void|Yaf_Response_Abstract
  */
 public function dispatch(Request_Abstract $request = null)
 {
     /**
      * Instantiate default request object (HTTP version) if none provided
      */
     if ($request == null) {
         $request = $this->getRequest();
     } else {
         $this->setRequest($request);
     }
     if (!$request instanceof Request_Abstract) {
         throw new Exception\TypeError('Expect a Yaf_Request_Abstract instance');
     }
     if ($request instanceof Request\Http) {
         $response = new Response\Http();
     } elseif ($request instanceof Request\Simple) {
         $response = new Response\Cli();
     }
     /**
      * Initialize router
      */
     $router = $this->getRouter();
     if (!$request->isRouted()) {
         /**
          * Notify plugins of router startup
          */
         foreach ($this->_plugins as $plugin) {
             $plugin->routerStartup($request, $response);
         }
         try {
             //@todo here seems there is 2 type of routes
             $router->route($request);
         } catch (\Exception $e) {
             if ($this->throwException() == true) {
                 throw $e;
             }
         }
         $this->_fixDefault($request);
         /**
          * Notify plugins of router shutdown
          */
         foreach ($this->_plugins as $plugin) {
             $plugin->routerShutdown($request, $response);
         }
     } else {
         $this->_fixDefault($request);
     }
     $view = $this->initView();
     /**
      * Notify plugins of dispatch loop startup
      */
     foreach ($this->_plugins as $plugin) {
         $plugin->dispatchLoopStartup($request, $response);
     }
     $nested = G::iniGet('yaf.forward_limit');
     // Begin dispatch
     try {
         /**
          * Route request to controller/action, if a router is provided
          */
         do {
             /**
              * Notify plugins of dispatch startup
              */
             foreach ($this->_plugins as $plugin) {
                 $plugin->preDispatch($request, $response);
             }
             /**
              * Dispatch request
              */
             $this->handle($request, $response, $view);
             $this->_fixDefault($request);
             /**
              * Notify plugins of dispatch completion
              */
             foreach ($this->_plugins as $plugin) {
                 $plugin->postDispatch($request, $response);
             }
             $nested--;
         } while (!$request->isDispatched() && $nested > 0);
         /**
          * Notify plugins of dispatch loop completion
          */
         foreach ($this->_plugins as $plugin) {
             $plugin->dispatchLoopShutdown($request, $response);
         }
     } catch (\Exception $e) {
         if ($this->throwException()) {
             throw $e;
         } else {
             Exception::trigger_error($e->getMessage(), E_USER_ERROR);
         }
     }
     if ($nested == 0 && !$request->isDispatched()) {
//.........这里部分代码省略.........
开发者ID:zhangjingpu,项目名称:yaf-lib,代码行数:101,代码来源:Dispatcher.php

示例3: resolveDirectory

 private function resolveDirectory($class)
 {
     if ($this->isLocalName($class)) {
         $directory = $this->_library;
     } else {
         $directory = $this->_globalLibrary;
     }
     if ($directory == '') {
         Exception::trigger_error('Yaf_Loader requires Yaf_Application' . '(which set the library_directory) to be initialized first', E_USER_WARNING);
     }
     return $directory;
 }
开发者ID:liu33851861,项目名称:CZD_Yaf_Extension,代码行数:12,代码来源:Loader.php


注:本文中的Exception::trigger_error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。