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


PHP Pimple::end方法代码示例

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


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

示例1: refresh

 protected function refresh()
 {
     $this->setSkipView(true);
     Url::refresh();
     Pimple::end();
 }
开发者ID:hofmeister,项目名称:Pimple,代码行数:6,代码来源:Controller.php

示例2: ref

 /**
  * Show pimple reference (only available in dev mode)
  */
 public function ref()
 {
     if (Pimple::getEnvironment() != 'development') {
         Pimple::end('Not allowed');
     }
     include_once 'ref/RefReader.php';
     $this->setSkipLayout(true);
     $reader = new RefReader();
     //$reader->read(PIMPLEBASE.'/lib/taglib/FormTagLib.php','RefTagLib','RefTagLibMethod');
     $reader->read(BASEDIR . '/taglib/', 'RefTagLib', 'RefTagLibMethod');
     $reader->read(PIMPLEBASE . '/lib/taglib/', 'RefTagLib', 'RefTagLibMethod');
     $tags = $reader->getClass('FormTagLib')->getTags();
     $taglibs = $reader->getClasses();
     $reader = new RefReader();
     $reader->read(BASEDIR . '/controller/', 'RefController', 'RefControllerMethod');
     $reader->read(PIMPLEBASE . '/lib/controller/', 'RefController', 'RefControllerMethod');
     $controllers = $reader->getClasses();
     return array('taglibs' => $taglibs, 'controllers' => $controllers);
 }
开发者ID:hofmeister,项目名称:Pimple,代码行数:22,代码来源:PimpleController.php

示例3: startDaemon

 /**
  * Returns true if succesful start - and false if already running...
  *
  * @param string $pidFile
  * @return boolean
  */
 public function startDaemon($pidFile)
 {
     if (is_file($pidFile)) {
         $pid = file_get_contents($pidFile);
         if ($this->isPidAlive($pid)) {
             return false;
         }
     }
     $pid = pcntl_fork();
     if ($pid) {
         //Parent process - exit...
         $fp = fopen($pidFile, 'w');
         if ($fp) {
             fputs($fp, $pid, strlen($pid));
             fclose($fp);
             $this->displayLine('Daemon started');
             Pimple::end();
         } else {
             $this->killPid($pid);
             $this->displayErrorAndExit(sprintf('Could not create pidfile: %s', $pidFile));
         }
     }
     $this->currentPid = $pidFile;
     $this->daemon = true;
     return true;
 }
开发者ID:hofmeister,项目名称:Pimple,代码行数:32,代码来源:Cli.php

示例4: execute

 public function execute()
 {
     if (Settings::get(Settings::DEBUG, false)) {
         if (isset($_GET['__clearcache'])) {
             //Clear cache
             Dir::emptyDir(CACHEDIR, true);
         }
         if (isset($_GET['__clearview'])) {
             //Clear cache
             Dir::emptyDir(Dir::concat(CACHEDIR, 'view'), true);
         }
         if (isset($_GET['__clearjs'])) {
             //Clear cache
             Dir::emptyDir(Dir::concat(CACHEDIR, 'js'), true);
         }
         if (isset($_GET['__clearcss'])) {
             //Clear cache
             Dir::emptyDir(Dir::concat(CACHEDIR, 'css'), true);
         }
     }
     try {
         if (!String::isAlphaNum($this->controller)) {
             header("HTTP/1.0 404 Invalid url");
             throw new HttpNotFoundException(T('Invalid controller: %s', $this->controller));
         }
         if (!String::isAlphaNum($this->action)) {
             header("HTTP/1.1 404 Invalid url");
             throw new HttpNotFoundException(T('Invalid action: %s', $this->action));
         }
         $ctrlClass = ucfirst($this->controller) . 'Controller';
         $appViewFile = 'application';
         $viewFile = $this->getViewFile();
         if (!class_exists($ctrlClass)) {
             $ctrlFile = Dir::normalize(BASEDIR) . 'controller/' . $ctrlClass . '.php';
             if (!File::exists($ctrlFile)) {
                 header("HTTP/1.1 404 Controller not found");
                 throw new HttpNotFoundException(T('Controller not found: %s', $ctrlFile));
             }
             require_once $ctrlFile;
         }
         if (!class_exists($ctrlClass)) {
             header("HTTP/1.1 404 Controller not Found");
             throw new HttpNotFoundException(T('Controller not found: %s', $ctrlClass));
         }
         $ctrl = new $ctrlClass();
         $this->controllerInstance = $ctrl;
         if (!method_exists($ctrl, $this->action)) {
             header("HTTP/1.1 404 Action not Found");
             throw new HttpNotFoundException(T('Action not found: %s::%s', $ctrlClass, $this->action));
         }
         $action = $this->action;
         if (!$ctrl->getSkipView()) {
             try {
                 $view = new View($viewFile);
             } catch (Exception $e) {
                 //Ignore for now
             }
         }
         try {
             $data = $ctrl->{$action}();
         } catch (ValidationException $e) {
             //Do nothing...
         } catch (Interrupt $e) {
             //Do nothing...
         } catch (ErrorException $e) {
             MessageHandler::instance()->addError($e->getMessage());
         }
         if (!$data) {
             $data = $ctrl->getData();
         }
         if (!$ctrl->getSkipView()) {
             if ($view) {
                 $this->body = $view->render($data);
             } else {
                 if (!Request::isAjax()) {
                     header("HTTP/1.1 500 View not Found");
                     throw new Exception(T('View not found: %s', $viewFile));
                 }
             }
         }
     } catch (HttpNotFoundException $e) {
         trigger_error(sprintf("Path not found %s", self::getPath()), E_USER_ERROR);
         if (!Request::isAjax()) {
             Url::redirect('error', 'notfound');
         }
         Pimple::end();
     } catch (Exception $e) {
         header("HTTP/1.1 500 Internal error");
         if (Request::isAjax()) {
             $this->body = json_encode(array('msg' => $e->getMessage(), 'trace' => $e->getTraceAsString()));
         } else {
             if (Settings::get(Settings::DEBUG, false)) {
                 $body = $e->__toString();
                 if (!stristr($body, '<')) {
                     $body = '<pre>' . $body . '</pre>';
                 }
                 $this->body = $body;
             } else {
                 trigger_error(sprintf("Unexpected exception thrown in %s:\n\t%s", self::getPath(), $e->__toString()), E_USER_ERROR);
                 Url::redirect('error', 'internal');
//.........这里部分代码省略.........
开发者ID:hofmeister,项目名称:Pimple,代码行数:101,代码来源:Pimple.php

示例5: read


//.........这里部分代码省略.........
                    } elseif (preg_match('/[A-Z0-9]/i',$this->nextChar) && !$this->isWithin(self::SCRIPT)) {
                        $this->onTagStart();
                    }
                    
                    break;
                case '>':
                    if (mb_substr($string,$i-2,2) == '--' && $this->isWithin(self::COMMENT)) {
                        $this->popWithin();
                        break;
                    }
                    //Handle conditional comments
                    if (($this->conditionalComment && $this->lastChar == ']') && $this->isWithin(self::COMMENT)) {
                        $this->conditionalComment = false;
                        $this->popWithin();
                        break;
                    }
                    if ($this->lastChar == '?' && $this->isWithin(self::PHP)) {
                        $this->popWithin();
                    } elseif ($this->isWithin(self::TAGEND)) {
                        $this->checkEndTag();
                        $this->popWithin();
                        $this->onNodeEnd();
                        $this->ignoreChars = false;
                        $this->ignoreNextChar(1);
                    } elseif ($this->isWithin(self::DOCTYPE)) {
                        $this->popWithin();
                        $this->onWordEnd();
                    } elseif(!$this->ignoreTags()) {
                        $this->onWordEnd();
                        if ($this->isWithin(self::TAG))
                            $this->ignoreNextChar(2);
                        $this->onTagEnd();
                    }
                    
                    break;
                case ':':
                    if ($this->isWithin(self::ATTR)) {
                        
                        break;
                    }
                case '%':
                    if ($this->ignoreTags()) break;
                    if ($this->nextChar == '{') {
                        $this->pushWithin(self::P_EVAL);
                        break;
                    }
                case '}':
                    if ($this->isWithin(self::P_EVAL) && $this->lastChar != '\\') {
                        $this->popWithin();
                        break;
                    }
                
                case ' ':
                case "\t":
                case "\n":
                case "\r":
                case '/':
                case '=':
                    if ($this->ignoreTags() && !$this->isWithin(self::ATTR)) break;
                    $this->onWordEnd();
                    break;
                case '"':
                case '\'':
                    if (!$this->isWithin(self::TAG,true)) break;
                    if ($this->isWithin(self::STRING)) {
                        $this->onStringEnd();
                    } else {
                        $this->onStringStart();
                    }
                    break;
                case '[':
                    if (mb_substr($string,$i-4,4) == '<!--' && $this->isWithin(self::COMMENT)) {
                        $this->conditionalComment = true;
                    }
                default:
                    $this->onWordStart();
                    
                    break;
            }
            $ascii = ord($this->char);
            if (in_array($ascii,$ignoredAscii))
                $this->debug("CHR:chr($ascii)");
            else
                $this->debug("CHR:$this->char");
            $this->addChar($this->char);
            $this->lastChar = $this->char;
        }
        $text = $this->getCurrent();
        if ($text)
            $this->getNode()->addChild(new PhtmlNodeText($text));

        $node = $this->getNode();
        $this->clear();
        if (Settings::get(Settings::DEBUG,false) && $_GET['__viewdebug'] == $file) {
            $test = new PhtmlException($this->phtmlRaw,$this->char,$this->lineCount,$this->charCount,$this->debugTrace);
            echo $test;
            Pimple::end();
        }
        return $node;
    }
开发者ID:hofmeister,项目名称:Pimple,代码行数:101,代码来源:Phtml.php


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