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


PHP Registry::store方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $settings = $request->all();
     unset($settings['_token']);
     \Registry::store($settings);
     return redirect()->back()->with(array('status' => 'success', 'message' => 'Configuration mises à jour'));
 }
开发者ID:DesignPond,项目名称:cocobeauty,代码行数:13,代码来源:ConfigController.php

示例2: load_class

function load_class($className, $type = 'Core', $surpress = FALSE)
{
    // Now we need to make sure the user supplied some sort of path
    if (strpos($className, $type) === FALSE) {
        $className = $type . '\\' . $className;
    }
    // Make a lowercase version, and a storage name
    $class = strtolower($className);
    $store_name = str_replace('\\', '_', $class);
    // Check the registry for the class, If its there, then return the class
    $loaded = \Registry::load($store_name);
    if ($loaded !== NULL) {
        return $loaded;
    }
    // ---------------------------------------------------------
    // Class not in Registry, So we load it manually and then  |
    // store it in the registry for future static use          |
    // ---------------------------------------------------------
    // We need to find the file the class is stored in. Good thing the
    // Namespaces are pretty much paths to the class ;)
    $parts = explode('\\', $class);
    $last = count($parts) - 1;
    $parts[$last] = ucfirst($parts[$last]);
    // Build our filepath
    $file = implode(DS, $parts);
    $file = SYSTEM_PATH . DS . $file . '.php';
    // Include our file. If it doesnt exists, class is un-obtainable.
    require_once $file;
    //  Initiate the new class into a variable
    try {
        $Obj = new $className();
    } catch (\Exception $e) {
        $message = $e->getMessage();
        $Obj = FALSE;
    }
    // Display error?
    if (!is_object($Obj) && !$surpress) {
        show_error('class_init_failed', array($className, $message), E_ERROR);
    }
    // Store this new object in the registery
    \Registry::store($store_name, $Obj);
    // return the object.
    return $Obj;
}
开发者ID:Kheros,项目名称:Plexis,代码行数:44,代码来源:Common.php

示例3: realm

 public function realm($instance = TRUE)
 {
     // Get our emulator from the Config File
     $emulator = ucfirst(config('emulator'));
     $class_name = "Emulator_" . $emulator;
     // Make sure we havent loaded the lib already
     $realm = \Registry::load($class_name);
     if ($realm !== NULL) {
         goto Instance;
     }
     // Init the class if it doesnt exist
     if (!class_exists('Wowlib', false)) {
         $this->_initWowlib();
     }
     // Add debug tracer
     \Debug::trace('Loading Realm from Wowlib', __FILE__, __LINE__);
     // Fetch the emulator class
     try {
         $realm = \Wowlib::getRealm(0, 'RDB');
     } catch (\Exception $e) {
         \Debug::silent_mode(false);
         $message = 'Wowlib Error: ' . $e->getMessage();
         // Add debug tracer
         \Debug::trace($message, __FILE__, __LINE__);
         show_error($message, false, E_ERROR);
     }
     // Store the class statically and return the class
     \Registry::store($class_name, $realm);
     // Instance
     Instance:
     if ($instance == TRUE) {
         $FB = get_instance();
         if (is_object($FB)) {
             $FB->realm = $realm;
         }
     }
     // We need to make sure the realm loaded ok, or thrown an error
     if (!is_object($realm)) {
         // Add debug tracer
         $message = 'Wowlib failed to fetch realm. Assuming the realm database is offline.';
         \Debug::trace($message, __FILE__, __LINE__);
         show_error($message, false, E_ERROR);
     } else {
         \Debug::trace('Successfully fetched the realm connection from the Wowlib', __FILE__, __LINE__);
     }
     return $realm;
 }
开发者ID:Kheros,项目名称:Plexis,代码行数:47,代码来源:Loader.php


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