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


PHP RequestHandler::GetBaseDirectory方法代码示例

本文整理汇总了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;
 }
开发者ID:tallgrrl,项目名称:utopia-wrapper,代码行数:8,代码来源:RequestHandler.class.php

示例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;
 }
开发者ID:tallgrrl,项目名称:utopia-wrapper,代码行数:48,代码来源:Core.class.php


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