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


PHP SplClassLoader::setNamespaceSeparator方法代碼示例

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


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

示例1: file

        $bt = debug_backtrace();
        $lines = file($bt[1]['file']);
        preg_match('/([a-zA-Z0-9\\_]+)::' . $bt[1]['function'] . '/', $lines[$bt[1]['line'] - 1], $matches);
        return $matches[1];
    }
}
try {
    require_once APP_PATH . '/public/SplClassLoader.php';
    $classLoader = new SplClassLoader('Hmv', APP_PATH . '/../vendor/Hmv4');
    $classLoader->setNamespaceSeparator('_');
    $classLoader->register();
    $classLoader = new SplClassLoader('Tasks', APP_PATH . '/src');
    $classLoader->setNamespaceSeparator('_');
    $classLoader->register();
    $classLoader = new SplClassLoader(null, APP_PATH . '/../vendor');
    $classLoader->setNamespaceSeparator('_');
    $classLoader->register();
    $configPath = dirname(__FILE__) . '/../config/config.' . BATCH_EXEC_ENVIRONMENT . '.php';
    $config = @(include $configPath);
    if ($config === false) {
        throw new Exception('config load error: "' . $configPath . '" file is not found.');
    }
    // PSR-0に則りきれないのでここで強製的にrequire_onceしてしまう
    require_once APP_PATH . '/../vendor/Qdmail/qdmail.php';
    require_once APP_PATH . '/../vendor/Qdmail/qdsmtp.php';
    require_once APP_PATH . '/../vendor/Amazon/S3.php';
    include APP_PATH . '/config/services.php';
    $runner = new Teamlab_Batch_Task_Runner($di);
    $runner->run();
} catch (Exception $e) {
    /** @var Hmv_Mail $mailer */
開發者ID:qpzm7913,項目名稱:batch,代碼行數:31,代碼來源:index.php

示例2: SplClassLoader

 *
 */
/*******************************
 * General Set-up
 *******************************/
// check to see if json_decode exists. might be disabled in installs of PHP 5.5
if (!function_exists("json_decode")) {
    print "Please check that your version of PHP includes the JSON extension. It's required for Pattern Lab to run. Aborting.\n";
    exit;
}
// auto-load classes
require __DIR__ . "/lib/SplClassLoader.php";
$loader = new SplClassLoader('PatternLab', __DIR__ . '/lib');
$loader->register();
$loader = new SplClassLoader('Mustache', __DIR__ . '/lib');
$loader->setNamespaceSeparator("_");
$loader->register();
/*******************************
 * Console Set-up
 *******************************/
$console = new PatternLab\Console();
// set-up the generate command and options
$console->setCommand("g", "generate", "Generate Pattern Lab", "The generate command generates an entire site a single time. By default it removes old content in public/, compiles the patterns and moves content from source/ into public/");
$console->setCommandOption("g", "p", "patternsonly", "Generate only the patterns. Does NOT clean public/.", "To generate only the patterns:");
$console->setCommandOption("g", "n", "nocache", "Set the cacheBuster value to 0.", "To turn off the cacheBuster:");
$console->setCommandOption("g", "c", "enablecss", "Generate CSS for each pattern. Resource intensive.", "To run and generate the CSS for each pattern:");
// set-up an alias for the generate command
$console->setCommand("b", "build", "Alias for the generate command", "Alias for the generate command. Please refer to it's help for full options.");
// set-up the watch command and options
$console->setCommand("w", "watch", "Watch for changes and regenerate", "The watch command builds Pattern Lab, watches for changes in source/ and regenerates Pattern Lab when there are any.");
$console->setCommandOption("w", "p", "patternsonly", "Watches only the patterns. Does NOT clean public/.", "To watch and generate only the patterns:");
開發者ID:nielsonm,項目名稱:pattern-lab-starter,代碼行數:31,代碼來源:builder.php

示例3: dirname

<?php

if (version_compare(PHP_VERSION, '5.3', '>=')) {
    $loader = (require_once __DIR__ . '/vendor/autoload.php');
} else {
    require_once dirname(__FILE__) . '/vendor/splclassloader/SplClassLoader.php';
    require_once dirname(__FILE__) . '/src/Snidel.php';
    $loader = new SplClassLoader('Snidel', dirname(__FILE__) . '/src');
    $loader->setNamespaceSeparator('_');
    $loader->register();
}
開發者ID:TomoakiNagahara,項目名稱:snidel,代碼行數:11,代碼來源:autoload.php


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