本文整理汇总了PHP中RequestHandler::GetBaseDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestHandler::GetBaseDirectory方法的具体用法?PHP RequestHandler::GetBaseDirectory怎么用?PHP RequestHandler::GetBaseDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestHandler
的用法示例。
在下文中一共展示了RequestHandler::GetBaseDirectory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getServiceRegistry
public static function getServiceRegistry($selector)
{
$serviceRegistry = parse_ini_file(RequestHandler::GetBaseDirectory() . "/ini/serviceRegistry.ini", true);
if (array_key_exists($selector, $serviceRegistry)) {
return $serviceRegistry[$selector];
}
return null;
}
示例2: display
public function display($data, $template)
{
header("generatedBy: Tracy Lauren");
header("Framework: Utopia Framework");
if (!isset($_REQUEST['__outmode'])) {
$_REQUEST['__outmode'] = 'render';
}
switch ($_REQUEST['__outmode']) {
case 'xml':
// this requires the pear XML_Serializer package to be installed
// to install run the following command: "pear install XML_Serializer-beta"
require_once "XML/Serializer.php";
header('Content-Type: text/xml');
$serializer = new XML_Serializer(array("indent" => "\t", "linebreak" => "\n", "typeHints" => false, "addDecl" => true, "encoding" => "UTF-8", "rootName" => "result", "defaultTagName" => "item"));
$result = $serializer->serialize($data);
if ($result === true) {
echo $serializer->getSerializedData();
} else {
throw new BadRequestException("Failed to serialize data to XML");
}
break;
case 'json':
header('Content-Type: text/plain');
$__json = json_encode($data);
if (json_last_error() != JSON_ERROR_NONE && strlen($__json) == 0) {
throw new BadRequestException("Failed to serialize data to JSON");
}
print $__json;
break;
default:
$templateChain = array('default');
$browser = new Browser();
if (in_array($browser->getBrowser(), array(Browser::BROWSER_IPHONE, Browser::BROWSER_IPOD, Browser::BROWSER_IPAD))) {
$templateChain[] = 'mobile';
}
extract($data);
foreach (array_reverse($templateChain) as $templateRoot) {
if (file_exists(RequestHandler::GetBaseDirectory() . 'templates/' . $templateRoot . '/' . $template)) {
include RequestHandler::GetBaseDirectory() . 'templates/' . $templateRoot . '/' . $template;
// only include the first template that was found in the chain
break;
}
}
break;
}
// this function is only allowed to be called once, and is the final step in a request
exit;
}