本文整理汇总了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 */
示例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:");
示例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();
}