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


PHP kString::getCommonPostfix方法代码示例

本文整理汇总了PHP中kString::getCommonPostfix方法的典型用法代码示例。如果您正苦于以下问题:PHP kString::getCommonPostfix方法的具体用法?PHP kString::getCommonPostfix怎么用?PHP kString::getCommonPostfix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kString的用法示例。


在下文中一共展示了kString::getCommonPostfix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateMultiUrl

 protected static function generateMultiUrl(array $flavors)
 {
     $urls = array();
     foreach ($flavors as $flavor) {
         $urls[] = $flavor['url'];
     }
     $urls = array_unique($urls);
     if (count($urls) == 1) {
         $baseUrl = reset($urls);
         return '/' . ltrim($baseUrl, '/');
     }
     $prefix = kString::getCommonPrefix($urls);
     $prefixLen = strlen($prefix);
     $postfix = kString::getCommonPostfix($urls);
     $postfixLen = strlen($postfix);
     $middlePart = ',';
     foreach ($urls as $url) {
         $middlePart .= substr($url, $prefixLen, strlen($url) - $prefixLen - $postfixLen) . ',';
     }
     $baseUrl = $prefix . $middlePart . $postfix;
     return '/' . ltrim($baseUrl, '/') . '.urlset';
 }
开发者ID:DBezemer,项目名称:server,代码行数:22,代码来源:VodPackagerDeliveryUtils.php

示例2: generateMultiUrl

 protected static function generateMultiUrl(array $flavors, entry $entry)
 {
     $urls = array();
     foreach ($flavors as $flavor) {
         $urls[] = $flavor['url'];
     }
     $urls = array_unique($urls);
     if (count($urls) == 1) {
         $baseUrl = reset($urls);
         return '/' . ltrim($baseUrl, '/');
     }
     $prefix = kString::getCommonPrefix($urls);
     $postfix = kString::getCommonPostfix($urls);
     if ($entry->getType() == entryType::PLAYLIST) {
         // in case of a playlist, need to merge the flavor params of the urls
         // instead of using a urlset, since nginx-vod does not support urlsets of
         // non-trivial mapping responses.
         // so instead of building:
         //		/p/123/serveFlavor/entryId/0_abc/flavorParamIds/100,1,2,3,/forceproxy/true/name/a.mp4.urlset
         // we build:
         //		/p/123/serveFlavor/entryId/0_abc/flavorParamIds/1001,1002,1003/forceproxy/true/name/a.mp4.urlset
         $prefix = substr($prefix, 0, strrpos($prefix, '/') + 1);
         $postfix = substr($postfix, strpos($postfix, '/'));
     }
     $prefixLen = strlen($prefix);
     $postfixLen = strlen($postfix);
     $middlePart = ',';
     foreach ($urls as $url) {
         $middlePart .= substr($url, $prefixLen, strlen($url) - $prefixLen - $postfixLen) . ',';
     }
     if ($entry->getType() == entryType::PLAYLIST && strpos($middlePart, '/') === false) {
         $middlePart = rtrim(ltrim($middlePart, ','), ',');
         $result = $prefix . $middlePart . $postfix;
     } else {
         $result = $prefix . $middlePart . $postfix . '.urlset';
     }
     return '/' . ltrim($result, '/');
 }
开发者ID:wzur,项目名称:server,代码行数:38,代码来源:VodPackagerDeliveryUtils.php


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