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


PHP runkit_import函数代码示例

本文整理汇总了PHP中runkit_import函数的典型用法代码示例。如果您正苦于以下问题:PHP runkit_import函数的具体用法?PHP runkit_import怎么用?PHP runkit_import使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: php_check_syntax

<?php

include $GET_['x'];
include_once $GET_['x'];
php_check_syntax($GET_['x']);
require $GET_['x'];
require_once $GET_['x'];
runkit_import($GET_['x']);
set_include_path($GET_['x']);
virtual($GET_['x']);
开发者ID:QSC-PLT,项目名称:17eyes,代码行数:10,代码来源:fileinc4.php

示例2: reRequireFile

 /**
  * @param string $filename
  *
  * @return null
  */
 protected static function reRequireFile($filename)
 {
     if (function_exists('runkit_import')) {
         $result = runkit_import($filename, RUNKIT_IMPORT_FUNCTIONS | RUNKIT_IMPORT_CLASS_METHODS | RUNKIT_IMPORT_OVERRIDE);
         if (!$result) {
             self::markTestSkipped("Failed to reimport file {$filename}");
         }
     }
 }
开发者ID:samj1912,项目名称:repo,代码行数:14,代码来源:PhpseclibTestCase.php

示例3: reRequireFile

 /**
  * @param string $filename Filename relative to library directory.
  *
  * @return null
  */
 protected static function reRequireFile($filename)
 {
     if (extension_loaded('runkit')) {
         $result = runkit_import(sprintf('%s/../phpseclib/Msulistijo/PhpseclibBundle/%s', __DIR__, $filename), RUNKIT_IMPORT_FUNCTIONS | RUNKIT_IMPORT_CLASS_METHODS | RUNKIT_IMPORT_OVERRIDE);
         if (!$result) {
             self::markTestSkipped("Failed to reimport file {$filename}");
         }
     }
 }
开发者ID:msulistijo,项目名称:PhpseclibBundle,代码行数:14,代码来源:PhpseclibTestCase.php

示例4: fromFile

 public static function fromFile($file)
 {
     // RUNKIT_IMPORT_OVERRIDE    | RUNKIT_IMPORT_FUNCTIONS     |
     // RUNKIT_IMPORT_CLASSES     | RUNKIT_IMPORT_CLASS_METHODS |
     // RUNKIT_IMPORT_CLASS_PROPS | RUNKIT_IMPORT_CLASS_CONSTS
     // => 4127
     static $flags = 4127;
     return runkit_import($file, $flags);
 }
开发者ID:alexpw,项目名称:boris,代码行数:9,代码来源:Reloader.php

示例5: importChanges

 public static function importChanges($instance)
 {
     try {
         $reflection = new ReflectionClass($instance);
     } catch (ReflectionException $e) {
         LegacyLogger::log("WARN", "Registry", "RUNKIT: Failed to reflect class, reason was: '" . $e->getMessage() . "'");
         return;
     }
     LegacyLogger::log("DEBUG", "Registry", "Re-importing file '" . $reflection->getFileName() . "'");
     runkit_import($reflection->getFileName(), RUNKIT_IMPORT_CLASSES | RUNKIT_IMPORT_FUNCTIONS | RUNKIT_IMPORT_OVERRIDE);
 }
开发者ID:unkerror,项目名称:Budabot,代码行数:11,代码来源:Registry.class.php

示例6: onPacket

 /**
  * @param $p
  */
 protected function onPacket($p)
 {
     if ($p['op'] === 'spawnInstance') {
         $fullname = $p['appfullname'];
         $fullname = str_replace('-', ':', $fullname);
         if (mb_orig_strpos($fullname, ':') === false) {
             $fullname .= ':';
         }
         list($app, $name) = explode(':', $fullname, 2);
         Daemon::$appResolver->getInstance($app, $name, true, true);
     } elseif ($p['op'] === 'importFile') {
         if (!Daemon::$config->autoreimport->value) {
             Daemon::$process->gracefulRestart();
             return;
         }
         $path = $p['path'];
         Timer::add(function ($event) use($path) {
             if (Daemon::supported(Daemon::SUPPORT_RUNKIT_IMPORT)) {
                 //Daemon::log('--start runkit_import('.$path.')');
                 runkit_import($path, RUNKIT_IMPORT_FUNCTIONS | RUNKIT_IMPORT_CLASSES | RUNKIT_IMPORT_OVERRIDE);
                 //Daemon::log('--end runkit_import('.$path.')');
             } else {
                 $this->appInstance->log('Cannot import \'' . $path . '\': runkit_import is not callable.');
             }
             $event->finish();
         }, 5);
     } elseif ($p['op'] === 'call') {
         if (mb_orig_strpos($p['appfullname'], ':') === false) {
             $p['appfullname'] .= ':';
         }
         list($app, $name) = explode(':', $p['appfullname'], 2);
         if ($app = Daemon::$appResolver->getInstance($app, $name)) {
             $app->RPCall($p['method'], $p['args']);
         }
     }
 }
开发者ID:kakserpom,项目名称:phpdaemon,代码行数:39,代码来源:WorkerConnection.php

示例7: reloadController

 function reloadController($mvc, $controller_file)
 {
     if (extension_loaded('runkit') and $this->server->config['apps']['auto_reload']) {
         clearstatcache();
         $fstat = stat($controller_file);
         //修改时间大于加载时的时间
         if ($fstat['mtime'] > $this->env['controllers'][$mvc['controller']]['time']) {
             runkit_import($controller_file, RUNKIT_IMPORT_CLASS_METHODS | RUNKIT_IMPORT_OVERRIDE);
             $this->env['controllers'][$mvc['controller']]['time'] = time();
         }
     }
 }
开发者ID:abc1225,项目名称:test2,代码行数:12,代码来源:Swoole.php

示例8: onPacket

 public function onPacket($p)
 {
     if ($p['op'] === 'spawnInstance') {
         $fullname = $p['appfullname'];
         $fullname = str_replace('-', ':', $fullname);
         if (strpos($fullname, ':') === false) {
             $fullname .= ':';
         }
         list($app, $name) = explode(':', $fullname, 2);
         Daemon::$appResolver->appInstantiate($app, $name);
     } elseif ($p['op'] === 'importFile') {
         $path = $p['path'];
         Daemon_TimedEvent::add(function ($event) use($path) {
             $self = Daemon::$process;
             if (Daemon::supported(Daemon::SUPPORT_RUNKIT_IMPORT)) {
                 runkit_import($path, RUNKIT_IMPORT_FUNCTIONS | RUNKIT_IMPORT_CLASSES | RUNKIT_IMPORT_OVERRIDE);
             } else {
                 $this->appInstance->log('Cannot import \'' . $path . '\': runkit_import is not callable.');
             }
             $event->finish();
         }, 5);
     } elseif ($p['op'] === 'call') {
         if (strpos($p['appfullname'], '-') === false) {
             $p['appfullname'] .= '-';
         }
         list($app, $name) = explode('-', $p['appfullname'], 2);
         if ($app = Daemon::$appResolver->getInstanceByAppName($app, $name)) {
             $app->RPCall($p['method'], $p['args']);
         }
     }
 }
开发者ID:ruslanchek,项目名称:phpdaemon,代码行数:31,代码来源:IPCManager.php

示例9: loadModule

 /**
  * This function will allow you to load a module into the manager, so
  * all callbacks and things will be forwarded properly.
  *
  * @param string $sName Name of the module you wish to load.
  * @param boolean $bReorder Re-organize all modules based on priority.
  * @throws Exception When the module could not be loaded.
  * @return boolean Indicates whether the module loaded successfully.
  */
 public function loadModule($sName, $bReorder = true)
 {
     if (isset($this->m_aModules[$sName])) {
         return false;
     }
     $sPath = self::MODULE_DIRECTORY . '/' . $sName;
     if (file_exists($sPath) && is_dir($sPath)) {
         $sPath .= '/Module.php';
     } else {
         $sPath .= '.php';
     }
     if (file_exists($sPath)) {
         if (class_exists($sName)) {
             /** This module was already loaded, just re-instantiate it. **/
             if (function_exists('runkit_import')) {
                 /** Overwrite it using runkit when available. **/
                 runkit_import($sPath, RUNKIT_IMPORT_OVERRIDE | RUNKIT_IMPORT_CLASSES);
             }
         } else {
             /** Try to define the expected class by including the file we expect it to be in. **/
             include_once $sPath;
             if (!class_exists($sName)) {
                 throw new \Exception('Module file does not define a class with the name ' . $sName . '.');
             }
         }
     } else {
         throw new \Exception('There was no file found which should contain the module ' . $sName . '.');
     }
     try {
         $this->m_aModules[$sName] = array('Instance' => new $sName(), 'Started' => time(), 'Methods' => array());
     } catch (\Exception $pException) {
         throw new \Exception('Exception occurred during instantiation of module ' . $sName . '.', 0, $pException);
     }
     if (!$this->m_aModules[$sName]['Instance'] instanceof ModuleBase) {
         unset($this->m_aModules[$sName]);
         throw new \Exception('The class ' . $sName . ' is not a module.');
     }
     $pClassObj = new \ReflectionClass($sName);
     foreach ($pClassObj->getMethods() as $pMethodObj) {
         $this->m_aModules[$sName]['Methods'][$pMethodObj->getName()] = $pMethodObj;
     }
     unset($pClassObj);
     if ($bReorder == true) {
         /** Re-order the modules. **/
         $this->prioritize();
     }
     /** Callback for other modules to inform them that a module has been loaded. **/
     $this->onModuleLoad($this->m_aModules[$sName]['Instance']);
     /** If this module has this callback as well, pass all other modules through it. **/
     if (isset($this->m_aModules[$sName]['Methods']['onModuleLoad'])) {
         foreach ($this->m_aModules as $sModuleName => $pModule) {
             if ($sModuleName == $sName) {
                 /** Already done this one. **/
                 continue;
             }
             $this->m_aModules[$sName]['Instance']->onModuleLoad($pModule['Instance']);
         }
     }
     return true;
 }
开发者ID:xhoogland,项目名称:Monique,代码行数:69,代码来源:ModuleManager.php

示例10: reload_class

 public static function reload_class($class)
 {
     $ref = new ReflectionClass($class);
     $filename = $ref->getFileName();
     return runkit_import($filename, RUNKIT_IMPORT_OVERRIDE | RUNKIT_IMPORT_CLASS_METHODS);
 }
开发者ID:linusshops,项目名称:self-modifying-code,代码行数:6,代码来源:SMC.php

示例11: load

 /**
  * Load a class definition
  *
  * @param string $className The className to load
  * @return true If success
  * @throws nExecption If the file isn't find
  */
 public static function load($className)
 {
     if (!class_exists($className) && !in_array($className, self::$loadedClass)) {
         if (!array_key_exists($className, self::$loadFiles)) {
             if ($file = file::nyroExists(array('name' => $className))) {
                 require $file;
                 self::$loadFiles[$className] = array($file);
                 self::$saveCacheLoad = true;
                 self::$loadedClass[] = $className;
                 if (defined('RUNKIT_VERSION')) {
                     $filesExtend = file::nyroExists(array('name' => $className, 'type' => 'extend', 'rtl' => false, 'list' => true));
                     if (!empty($filesExtend)) {
                         self::$loadFiles[$className][1] = $filesExtend;
                         foreach ($filesExtend as $fe) {
                             runkit_import($fe);
                         }
                     }
                 }
             } else {
                 if (!lib::load($className)) {
                     if (self::$throwOnLoad) {
                         throw new nException('Factory - load: Unable to find the file for ' . $className . '.');
                     } else {
                         return false;
                     }
                 }
             }
         } else {
             require self::$loadFiles[$className][0];
             self::$loadedClass[] = $className;
             if (defined('RUNKIT_VERSION') && array_key_exists(1, self::$loadFiles[$className])) {
                 foreach (self::$loadFiles[$className][1] as $fe) {
                     runkit_import($fe);
                 }
             }
         }
     }
     return true;
 }
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:46,代码来源:factory.class.php

示例12: onPacket

 public function onPacket($p)
 {
     if ($p['op'] === 'spawnInstance') {
         $fullname = $p['appfullname'];
         if (strpos($fullname, '-') === false) {
             $fullname .= '-';
         }
         list($app, $name) = explode('-', $fullname, 2);
         Daemon::$appResolver->appInstantiate($app, $name);
     } elseif ($p['op'] === 'importFile') {
         $path = $p['path'];
         Daemon_TimedEvent::add(function ($event) use($path) {
             $self = Daemon::$process;
             runkit_import($path, RUNKIT_IMPORT_FUNCTIONS | RUNKIT_IMPORT_CLASSES | RUNKIT_IMPORT_OVERRIDE);
             $event->finish();
         }, 5);
     } elseif ($p['op'] === 'call') {
         if (strpos($p['appfullname'], '-') === false) {
             $p['appfullname'] .= '-';
         }
         list($app, $name) = explode('-', $p['appfullname'], 2);
         if ($app = Daemon::$appResolver->getInstanceByAppName($app, $name)) {
             $app->RPCall($p['method'], $p['args']);
         }
     }
 }
开发者ID:J3FF3,项目名称:phpdaemon,代码行数:26,代码来源:IPCManager.php

示例13: loadPlugin

 /** Loads one plugin.
  * This function loads one plugin. It is a very basic function. It checks that plugin exists and isn't loaded yet, and include its file. All the remaining work
  * is done by PluginManager::initPlugin(), called inside the plugin file.
  * 
  * \param $plugin Plugin to be loaded.
  * \param $manual Manual loading indicator. It permits the bot to know if a plugin has been loaded manually or automatically, by dependence.
  * 
  * \return TRUE if plugin loaded successfully, FALSE otherwise.
  * In fact, this value, beyond the "plugin not found" error, depends of the return value of PluginManager::initPlugin.
  */
 public function loadPlugin($plugin, $manual = FALSE)
 {
     Leelabot::message('Loading plugin $0', array($plugin));
     //We check that the plugin is not already loaded
     if (in_array($plugin, $this->getLoadedPlugins())) {
         Leelabot::message('Plugin $0 is already loaded', array($plugin), E_WARNING);
         return FALSE;
     }
     if (!is_file('plugins/' . $plugin . '.php')) {
         Leelabot::message('Plugin $0 does not exists (File : $1)', array($plugin, getcwd() . '/plugins/' . $plugin . '.php'), E_WARNING);
         return FALSE;
     }
     if (!isset($this->_pluginCache[$plugin])) {
         include 'plugins/' . $plugin . '.php';
     } elseif (extension_loaded('runkit')) {
         runkit_import('plugins/' . $plugin . '.php', RUNKIT_IMPORT_OVERRIDE | RUNKIT_IMPORT_CLASS_METHODS);
     }
     return $this->initPlugin($this->_pluginCache[$plugin], $manual);
     //Else we reload the plugin with the cached data from the first loading
 }
开发者ID:Geolim4,项目名称:Leelabot,代码行数:30,代码来源:plugins.class.php

示例14: iUsePr

 /**
  * @Given I use pr :id
  */
 public function iUsePr($id)
 {
     exec(sprintf('cd vendor/knplabs/gaufrette && git stash && git pull origin master && curl -sS https://patch-diff.githubusercontent.com/raw/KnpLabs/Gaufrette/pull/%s.patch | git apply', $id));
     $this->checkRunkit();
     runkit_import('vendor/autoload.php', RUNKIT_IMPORT_OVERRIDE);
 }
开发者ID:akovalyov,项目名称:gaufrette-integration-tests,代码行数:9,代码来源:FeatureContext.php

示例15: process_dynamic

 function process_dynamic(&$request, &$response)
 {
     global $php;
     $php->__init();
     $request->setGlobal();
     $path = trim($request->meta['path'], '/');
     $url_route_func = $this->config['apps']['url_route'];
     $mvc = $url_route_func($path);
     $php->env['mvc'] = $mvc;
     /*---------------------加载MVC程序----------------------*/
     $controller_file = APPSPATH . '/controllers/' . $mvc['controller'] . '.php';
     if (!isset($php->env['controllers'][$mvc['controller']])) {
         if (is_file($controller_file)) {
             import_controller($controller_file);
         } else {
             $this->http_error(404, $response, "控制器 <b>{$mvc['controller']}</b> 不存在!");
             return $response;
         }
     }
     //将对象赋值到控制器
     $php->request = $request;
     $php->response = $response;
     /*---------------------检测代码是否更新----------------------*/
     if (extension_loaded('runkit') and $this->config['apps']['auto_reload']) {
         clearstatcache();
         $fstat = stat($controller_file);
         //修改时间大于加载时的时间
         if ($fstat['mtime'] > $php->env['controllers'][$mvc['controller']]['time']) {
             runkit_import($controller_file);
             $php->env['controllers'][$mvc['controller']]['time'] = time();
             $this->log("reload controller " . $mvc['controller']);
         }
     }
     /*---------------------处理MVC----------------------*/
     if (empty($mvc['param'])) {
         $param = array();
     } else {
         $param = $mvc['param'];
     }
     $response->head['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0';
     $response->head['Pragma'] = 'no-cache';
     $response->head['Content-Type'] = 'text/html; charset=' . $this->config['apps']['charset'];
     try {
         $controller = new $mvc['controller']($php);
         if (!method_exists($controller, $mvc['view'])) {
             $this->http_error(404, $response, "视图 <b>{$mvc['controller']}->{$mvc['view']}</b> 不存在!");
             return $response;
         }
         if ($controller->is_ajax) {
             $response->body = json_encode(call_user_func(array($controller, $mvc['view']), $param));
         } else {
             $response->body = call_user_func(array($controller, $mvc['view']), $param);
         }
     } catch (Exception $e) {
         if ($request->finish != 1) {
             $this->http_error(404, $response, $e->getMessage());
         }
     }
     //保存Session
     if ($php->session_open) {
         $php->session->save();
     }
     return $response;
 }
开发者ID:superwmh,项目名称:swoole,代码行数:64,代码来源:AppServer.class.php


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