本文整理汇总了PHP中oat\oatbox\service\ServiceManager::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ServiceManager::get方法的具体用法?PHP ServiceManager::get怎么用?PHP ServiceManager::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oat\oatbox\service\ServiceManager
的用法示例。
在下文中一共展示了ServiceManager::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$configService = $driver->connect('config', array('dir' => $root . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR, 'humanReadable' => true));
$serviceManager = new ServiceManager($configService);
$configPath = $root . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'tao' . DIRECTORY_SEPARATOR . 'websource_' . $webSourceId . '.conf.php';
if (!file_exists($configPath)) {
header('HTTP/1.0 403 Forbidden');
die;
}
$config = (include $configPath);
if (!is_array($config) || !isset($config['className'])) {
header('HTTP/1.0 403 Forbidden');
die;
}
$className = $config['className'];
$options = isset($config['options']) ? $config['options'] : array();
$source = new $className($options);
if (!$source instanceof FlyTokenWebSource) {
header('HTTP/1.0 403 Forbidden');
die;
}
$fsService = $serviceManager->get(FileSystemService::SERVICE_ID);
$fileSystem = $fsService->getFileSystem($source->getOption($source::OPTION_FILESYSTEM_ID));
$source->setFileSystem($fileSystem);
try {
$path = $source->getFilePathFromUrl($url);
$stream = $source->getFileStream($path);
tao_helpers_Http::returnStream($stream, $source->getMimetype($path));
$stream->detach();
} catch (\tao_models_classes_FileNotFoundException $e) {
header("HTTP/1.0 404 Not Found");
}
exit;