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


PHP get_mb_len函数代码示例

本文整理汇总了PHP中get_mb_len函数的典型用法代码示例。如果您正苦于以下问题:PHP get_mb_len函数的具体用法?PHP get_mb_len怎么用?PHP get_mb_len使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: transferCategories

 function transferCategories()
 {
     $sSql = "SELECT \r\n        \t\t\t`CategoryID` AS `id`, \r\n        \t\t\t`CategoryName` AS `name`\r\n        \t\tFROM `ArticlesCategory`";
     $rResult = mysql_query($sSql, $this->rOldDb);
     $iCount = mysql_num_rows($rResult);
     while ($aCategory = mysql_fetch_assoc($rResult)) {
         if (get_mb_len($aCategory['name']) > 32) {
             $aCategory['name'] = get_mb_substr($aCategory['name'], 0, 32);
         }
         if ($this->existsCategory($aCategory['name'], 0, $this->_sType)) {
             continue;
         }
         //escape all values
         $aCategory['name'] = $this->oMigrationModule->_oDb->escape($aCategory['name']);
         $sSql = "INSERT INTO `sys_categories`(`Category`, `ID`, `Type`, `Owner`, `Status`, `Date`)\r\n            \t\t VALUES('" . $aCategory['name'] . "', '0', '" . $this->_sType . "', '0', 'active', NOW())";
         $iResult = (int) $this->oDolModule->_oDb->query($sSql);
         if ($iResult <= 0) {
             $this->setResultStatus('Database error. Cannot insert category in the database.');
             return MIGRATION_FAILED;
         }
     }
     return MIGRATION_SUCCESSFUL;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:23,代码来源:BxDataMigrationArticles.php

示例2: uriGenerate

function uriGenerate($s, $sTable, $sField, $iMaxLen = 255)
{
    $s = uriFilter($s);
    if (uriCheckUniq($s, $sTable, $sField)) {
        return $s;
    }
    // try to add date
    if (get_mb_len($s) > 240) {
        $s = get_mb_substr($s, 0, 240);
    }
    $s .= '-' . date('Y-m-d');
    if (uriCheckUniq($s, $sTable, $sField)) {
        return $s;
    }
    // try to add number
    for ($i = 0; $i < 999; ++$i) {
        if (uriCheckUniq($s . '-' . $i, $sTable, $sField)) {
            return $s . '-' . $i;
        }
    }
    return rand(0, 999999999);
}
开发者ID:blas-dmx,项目名称:dolphin.pro,代码行数:22,代码来源:utils.inc.php

示例3: checkLength

 function checkLength($s, $iLenMin, $iLenMax)
 {
     if (is_array($s)) {
         foreach ($s as $k => $v) {
             $iLen = get_mb_len($v);
             if ($iLen < $iLenMin || $iLen > $iLenMax) {
                 return false;
             }
         }
         return true;
     }
     $iLen = get_mb_len($s);
     return $iLen >= $iLenMin && $iLen <= $iLenMax ? true : false;
 }
开发者ID:newton27,项目名称:dolphin.pro,代码行数:14,代码来源:BxDolForm.php

示例4: uriGenerate

function uriGenerate($s, $sTable, $sField, $iMaxLen = 255)
{
    //$s = get_mb_replace ('/[^\pL^\pN]+/u', '-', $s); // unicode characters
    $s = get_mb_replace('/([^\\d^\\w]+)/', '-', $s);
    // latin characters
    $s = get_mb_replace('/([-^]+)/', '-', $s);
    if (uriCheckUniq($s, $sTable, $sField)) {
        return $s;
    }
    // try to add date
    if (get_mb_len($s) > 240) {
        $s = get_mb_substr($s, 0, 240);
    }
    $s .= '-' . date('Y-m-d');
    if (uriCheckUniq($s, $sTable, $sField)) {
        return $s;
    }
    // try to add number
    for ($i = 0; $i < 999; ++$i) {
        if (uriCheckUniq($s . '-' . $i, $sTable, $sField)) {
            return $s . '-' . $i;
        }
    }
    return rand(0, 999999999);
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:25,代码来源:utils.inc.php

示例5: uriGenerate

function uriGenerate($s, $sTable, $sField, $sEmpty = '-')
{
    $s = uriFilter($s, $sEmpty);
    if (uriCheckUniq($s, $sTable, $sField)) {
        return $s;
    }
    // cut off redundant part
    if (get_mb_len($s) > 240) {
        $s = get_mb_substr($s, 0, 240);
    }
    // try to add date
    $s .= '-' . date('Y-m-d');
    if (uriCheckUniq($s, $sTable, $sField)) {
        return $s;
    }
    // try to add number
    for ($i = 0; $i < 999; ++$i) {
        if (uriCheckUniq($s . '-' . $i, $sTable, $sField)) {
            return $s . '-' . $i;
        }
    }
    return rand(0, 999999999);
}
开发者ID:blas-dmx,项目名称:trident,代码行数:23,代码来源:utils.inc.php

示例6: prepare

 /**
  * Prepare SQL query before execution if some arguments are need to be passed to it.
  * All parameters marked with question (?) symbol in SQL query are replaced with parameters passed after SQL query parameter.
  * Parameters are properly excaped and surrounded by qutes if needed.
  * Example:
  * @code
  * $sSql = $oDb->prepare("SELECT `a`, `b` from `t` WHERE `c` = ? and `d` = ?", 12, 'aa');
  * echo $sSql;// outputs: SELECT `a`, `b` from `t` WHERE `c` = 12 and `d` = 'aa'
  * $a = $oDb->getAll($sSql);
  * @endcode
  *
  * @param  string $sQuery SQL query, parameters for replacing are marked with ? symbol
  * @param  mixed  $mixed  any number if parameters to replace, number of parameters whould match number of ? symbols in SQL query
  * @return string with SQL query ready for execution
  */
 function prepare($sQuery)
 {
     $aArgs = func_get_args();
     $sQuery = array_shift($aArgs);
     $iPos = 0;
     foreach ($aArgs as $mixedArg) {
         if (is_null($mixedArg)) {
             $s = 'NULL';
         } elseif (is_numeric($mixedArg)) {
             $s = $mixedArg;
         } else {
             $s = "'" . mysql_real_escape_string($mixedArg) . "'";
         }
         $i = bx_mb_strpos($sQuery, '?', $iPos);
         $sQuery = bx_mb_substr_replace($sQuery, $s, $i, 1);
         $iPos = $i + get_mb_len($s);
     }
     return $sQuery;
 }
开发者ID:blas-dmx,项目名称:trident,代码行数:34,代码来源:BxDolDb.php

示例7: getCorrectUri

 function getCorrectUri($sCaption, $iOwnerId = 0, $bCheck = true)
 {
     $sUri = uriFilter($sCaption);
     if (!$sUri) {
         $sUri = '-';
     }
     if (!$bCheck) {
         return $sUri;
     }
     if ($this->checkUriUniq($sUri, $iOwnerId)) {
         return $sUri;
     }
     if (get_mb_len($sUri) > 240) {
         $sUri = get_mb_substr($sUri, 0, 240);
     }
     $sUri .= '-' . date('Y-m-d');
     if ($this->checkUriUniq($sUri, $iOwnerId)) {
         return $sUri;
     }
     for ($i = 0; $i < 999; ++$i) {
         if ($this->checkUriUniq($sUri . '-' . $i, $iOwnerId)) {
             return $sUri . '-' . $i;
         }
     }
     return time();
 }
开发者ID:Prashank25,项目名称:dolphin.pro,代码行数:26,代码来源:BxDolAlbums.php


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