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


PHP StrLen函数代码示例

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


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

示例1: Query

 public function Query()
 {
     $Length = StrLen($this->ServerIP);
     $Data = Pack('cccca*', HexDec($Length), 0, 0x4, $Length, $this->ServerIP) . Pack('nc', $this->ServerPort, 0x1);
     Socket_Send($this->Socket, $Data, StrLen($Data), 0);
     // handshake
     Socket_Send($this->Socket, "", 2, 0);
     // status ping
     $Length = $this->ReadVarInt();
     // full packet length
     if ($Length < 10) {
         return FALSE;
     }
     Socket_Read($this->Socket, 1);
     // packet type, in server ping it's 0
     $Length = $this->ReadVarInt();
     // string length
     $Data = Socket_Read($this->Socket, $Length, PHP_NORMAL_READ);
     // and finally the json string
     if ($Data === FALSE) {
         throw new MinecraftPingException('Server didn\'t return any data');
     }
     $Data = JSON_Decode($Data, true);
     if (JSON_Last_Error() !== JSON_ERROR_NONE) {
         if (Function_Exists('json_last_error_msg')) {
             throw new MinecraftPingException(JSON_Last_Error_Msg());
         } else {
             throw new MinecraftPingException('JSON parsing failed');
         }
         return FALSE;
     }
     return $Data;
 }
开发者ID:Cretezy,项目名称:Minecraft,代码行数:33,代码来源:MinecraftServerPing.php

示例2: newai_list_one

function newai_list_one()
{
    global $db, $common_html, $tablename_one, $tablename_two, $link;
    global $html_etc_one, $html_etc_two, $columns_one, $columns_two;
    global $tablename, $SYTEM_CONFIG_TABLE;
    global $SUNSHINE_USER_NAME_VAR, $SUNSHINE_USER_ID_VAR, $_SESSION;
    $USER_NAME = $_SESSION[$SUNSHINE_USER_NAME_VAR];
    print "<SCRIPT language=JavaScript>\n\tfunction clickMenu(url){\n\tparent.main_body.location=url;\n\t}\n\t</SCRIPT>\n\t";
    $one_array = explode(':', $tablename_one);
    //print_R($one_array);
    $link_array = explode(':', $link);
    //print_R($link_array);
    $columns = returntablecolumn($tablename);
    $columns_one = returntablecolumn($one_array[0]);
    $html_etc_one = returnsystemlang($one_array[0], $SYTEM_CONFIG_TABLE);
    switch ($db->databaseType) {
        case 'mysql':
            switch ($one_array[3]) {
                case 'name':
                    $sql_one = "select " . $columns_one[(string) $one_array[1]] . "," . $columns_one[(string) $one_array[2]] . " from " . $one_array[0] . " where " . $columns_one[(string) $one_array[4]] . "='" . $USER_NAME . "'";
                    break;
                case 'id':
                    $sql_one = "select " . $columns_one[(string) $one_array[1]] . "," . $columns_one[(string) $one_array[2]] . " from " . $one_array[0] . "";
                    break;
                default:
                    $sql_one = "select " . $columns_one[(string) $one_array[1]] . "," . $columns_one[(string) $one_array[2]] . " from " . $one_array[0] . "";
                    break;
            }
            break;
        case 'mssql':
            switch ($one_array[3]) {
                case 'name':
                    $sql_one = "select [" . $columns_one[(string) $one_array[1]] . "],[" . $columns_one[(string) $one_array[2]] . "] from [" . $one_array[0] . "] where [" . $columns_one[(string) $one_array[4]] . "]='" . $USER_NAME . "'";
                    break;
                case 'id':
                    $sql_one = "select [" . $columns_one[(string) $one_array[1]] . "],[" . $columns_one[(string) $one_array[2]] . "] from [" . $one_array[0] . "]";
                    break;
                default:
                    $sql_one = "select [" . $columns_one[(string) $one_array[1]] . "],[" . $columns_one[(string) $one_array[2]] . "] from [" . $one_array[0] . "]";
                    break;
            }
            break;
    }
    //print $sql_one;
    $rs_one = $db->CacheExecute(150, $sql_one);
    if ($rs_one->RecordCount() == 0) {
        print_infor($common_html['common_html']['norecord'], 'trip');
        exit;
    }
    while (!$rs_one->EOF) {
        if (StrLen($link_array[3]) > 2) {
            $LinkIndexName = (string) $link_array[3];
        } else {
            $LinkIndexName = $columns[(string) $link_array[3]];
        }
        $url = $link_array[0] . "?" . $link_array[1] . "=" . $link_array[2] . "&" . $LinkIndexName . "=" . $rs_one->fields[(string) $columns_one[(string) $one_array[1]]];
        print "\n\t<TABLE class=small cellSpacing=1 cellPadding=0 width='100%' align=center bgColor=#000000 border=0>\n\t<TBODY>\n\t<TR class=TableContent title='' style='CURSOR: hand'\t onclick=clickMenu('{$url}')>\n\t<TD noWrap align=middle><table class=small cellPadding=3 align=center width=100% border=0 onmouseover=bgColor='#ffffff' onmouseout=bgColor='#d3e5fa'>\n\t<Tr><td align=middle><B>" . $rs_one->fields[(string) $columns_one[(string) $one_array[2]]] . "</B></TD></TR>\n\t</table></TD></TR>\n\t</TBODY></TABLE>\n";
        $rs_one->MoveNext();
    }
}
开发者ID:shesai0519,项目名称:sunshineCRM,代码行数:60,代码来源:newai_listone.php

示例3: Read

 /**
  * @param int $Length
  * @throws AuthenticationException
  */
 public function Read($Length = 1400)
 {
     // GoldSource RCON has same structure as Query
     $this->Socket->Read();
     if ($this->Buffer->GetByte() !== SourceQuery::S2A_RCON) {
         return false;
     }
     $Buffer = $this->Buffer->Get();
     $Trimmed = Trim($Buffer);
     if ($Trimmed === 'Bad rcon_password.') {
         throw new AuthenticationException($Trimmed, AuthenticationException::BAD_PASSWORD);
     } else {
         if ($Trimmed === 'You have been banned from this server.') {
             throw new AuthenticationException($Trimmed, AuthenticationException::BANNED);
         }
     }
     $ReadMore = false;
     // There is no indentifier of the end, so we just need to continue reading
     // TODO: Needs to be looked again, it causes timeouts
     do {
         $this->Socket->Read();
         $ReadMore = $this->Buffer->Remaining() > 0 && $this->Buffer->GetByte() === SourceQuery::S2A_RCON;
         if ($ReadMore) {
             $Packet = $this->Buffer->Get();
             $Buffer .= SubStr($Packet, 0, -2);
             // Let's assume if this packet is not long enough, there are no more after this one
             $ReadMore = StrLen($Packet) > 1000;
             // use 1300?
         }
     } while ($ReadMore);
     $this->Buffer->Set(Trim($Buffer));
 }
开发者ID:GlitchedMan,项目名称:Life-Control,代码行数:36,代码来源:GoldSourceRcon.class.php

示例4: WriteData

 private function WriteData($Command, $String = "")
 {
     $Data = Pack('VV', $this->RequestId++, $Command) . $String . "";
     $Data = Pack('V', StrLen($Data)) . $Data;
     $Length = StrLen($Data);
     return $Length === FWrite($this->Socket, $Data, $Length);
 }
开发者ID:Najlepszy56,项目名称:Minecraft-Itemshop,代码行数:7,代码来源:rcon.php

示例5: sendMes

 /**
  * @param int $idUserFrom
  * @param int $idUserTo
  * @param string $title
  * @param string $type
  * @param string $idQuestion
  * @param string $textMessage
  * @return int
  */
 public static function sendMes($idUserFrom = 1, $idUserTo = 1, $title, $idQuestion, $textMessage = "", $type = "P")
 {
     $res = false;
     $senderUserID = $idUserFrom;
     $targetUserID = $idUserTo;
     $arFieldsMes = array("FROM_USER_ID" => $senderUserID, "TO_USER_ID" => $targetUserID, "TITLE" => $title, "MESSAGE" => $idQuestion, "DATE_CREATE" => date("d.m.Y H:i:s", time() - DIFFERENT_WITH_MOSCOW_TIME), "DATE_VIEW" => false, "MESSAGE_TYPE" => $type, "FROM_DELETED" => "N", "TO_DELETED" => "N", "SEND_MAIL" => "Y");
     if (CModule::IncludeModule("socialnetwork")) {
         $res = CSocNetMessages::Add($arFieldsMes);
         if ($res) {
             if (CModule::IncludeModule("iblock")) {
                 if (CModule::IncludeModule('payments')) {
                     $userInfo = new CLawPayment();
                     $InfoUserFrom = $userInfo->userInfo($idUserFrom);
                     $InfoUserTo = $userInfo->userInfo($idUserTo);
                     $emailFrom = $InfoUserFrom["EMAIL"];
                     $emailUser = $InfoUserTo["EMAIL"];
                     SendMessage::sendMessOnEmail($emailFrom, $emailUser, $title, $textMessage);
                 }
             }
         } else {
             $errorMessage = "";
             if ($err = $GLOBALS["APPLICATION"]->GetException()) {
                 $errorMessage = $err->GetString();
             }
             if (StrLen($errorMessage) <= 0) {
                 $errorMessage = GetMessage("SONET_UR_ERROR_CREATE_MESSAGE");
             }
             $GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_CREATE_MESSAGE");
         }
     }
     return $res;
 }
开发者ID:TzepART,项目名称:functionsAndClasses,代码行数:41,代码来源:send_messege.php

示例6: CheckFields

 function CheckFields($ACTION, &$arFields, $ID = 0)
 {
     if ((is_set($arFields, "SITE_ID") || $ACTION == "ADD") && StrLen($arFields["SITE_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SCGAT1_NO_SITE"), "EMPTY_SITE_ID");
         return false;
     }
     if (is_set($arFields, "RATE1")) {
         $arFields["RATE1"] = str_replace(",", ".", $arFields["RATE1"]);
         $arFields["RATE1"] = DoubleVal($arFields["RATE1"]);
     }
     if (is_set($arFields, "RATE2")) {
         $arFields["RATE2"] = str_replace(",", ".", $arFields["RATE2"]);
         $arFields["RATE2"] = DoubleVal($arFields["RATE2"]);
     }
     if (is_set($arFields, "RATE3")) {
         $arFields["RATE3"] = str_replace(",", ".", $arFields["RATE3"]);
         $arFields["RATE3"] = DoubleVal($arFields["RATE3"]);
     }
     if (is_set($arFields, "RATE4")) {
         $arFields["RATE4"] = str_replace(",", ".", $arFields["RATE4"]);
         $arFields["RATE4"] = DoubleVal($arFields["RATE4"]);
     }
     if (is_set($arFields, "RATE5")) {
         $arFields["RATE5"] = str_replace(",", ".", $arFields["RATE5"]);
         $arFields["RATE5"] = DoubleVal($arFields["RATE5"]);
     }
     return True;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:28,代码来源:affiliate_tier.php

示例7: Read

 /**
  * @param int $Length
  * @throws AuthenticationException
  * @return bool
  */
 public function Read($Length = 1400)
 {
     // GoldSource RCON has same structure as Query
     $Buffer = $this->Socket->Read();
     $StringBuffer = '';
     $ReadMore = false;
     // There is no indentifier of the end, so we just need to continue reading
     do {
         $ReadMore = $Buffer->Remaining() > 0;
         if ($ReadMore) {
             if ($Buffer->GetByte() !== SourceQuery::S2A_RCON) {
                 throw new InvalidPacketException('Invalid rcon response.', InvalidPacketException::PACKET_HEADER_MISMATCH);
             }
             $Packet = $Buffer->Get();
             $StringBuffer .= $Packet;
             //$StringBuffer .= SubStr( $Packet, 0, -2 );
             // Let's assume if this packet is not long enough, there are no more after this one
             $ReadMore = StrLen($Packet) > 1000;
             // use 1300?
             if ($ReadMore) {
                 $Buffer = $this->Socket->Read();
             }
         }
     } while ($ReadMore);
     $Trimmed = trim($StringBuffer);
     if ($Trimmed === 'Bad rcon_password.') {
         throw new AuthenticationException($Trimmed, AuthenticationException::BAD_PASSWORD);
     } else {
         if ($Trimmed === 'You have been banned from this server.') {
             throw new AuthenticationException($Trimmed, AuthenticationException::BANNED);
         }
     }
     $Buffer->Set($Trimmed);
     return $Buffer;
 }
开发者ID:xpaw,项目名称:php-source-query-class,代码行数:40,代码来源:GoldSourceRcon.php

示例8: Sherlock

 public function Sherlock($Buffer, $Length)
 {
     $Data = FRead($this->Socket, $Length);
     if (StrLen($Data) < 4) {
         return false;
     }
     $Buffer->Set($Data);
     return $Buffer->GetLong() === -2;
 }
开发者ID:jelakesh,项目名称:PHP-Source-Query,代码行数:9,代码来源:Socket.php

示例9: SonetDebugTmp

 function SonetDebugTmp($var, $name = "")
 {
     $fff = fopen($_SERVER["DOCUMENT_ROOT"] . "/~test.tmp", "a");
     if (is_array($var)) {
         fwrite($fff, (StrLen($name) > 0 ? $name . ":\n" : "") . print_r($var, true) . "\n\n");
     } else {
         fwrite($fff, (StrLen($name) > 0 ? $name . "=" : "") . $var . "\n\n");
     }
     fclose($fff);
 }
开发者ID:k-kalashnikov,项目名称:geekcon.local,代码行数:10,代码来源:install_demo.php

示例10: generate_pass

 public function generate_pass($maxlength = 10)
 {
     $chars = "qazxswedcvfrtgbnhyujmkiolp1234567890QAZXSWEDCVFRTGBNHYUJMKIOLP";
     $size = StrLen($chars) - 1;
     $pass = '';
     while ($maxlength--) {
         $pass .= $chars[rand(0, $size)];
     }
     return $pass;
 }
开发者ID:chernogolov,项目名称:blank,代码行数:10,代码来源:User.php

示例11: _generated

function _generated()
{
    $chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!?@#$%&*[]{}();:,<>~+=-_/|\\';
    // набор символов
    $max = 4;
    $size = StrLen($chars) - 1;
    $hash = null;
    while ($max--) {
        $hash .= $chars[rand(0, $size)];
    }
    return $hash;
}
开发者ID:alex1442,项目名称:000dn,代码行数:12,代码来源:index_page.php

示例12: generatePassword

 /**
  * Генерация случайного пароля
  */
 public function generatePassword($maxChars)
 {
     $chars = "qazxswedcvfrtgbnhyujmkiolp1234567890QAZXSWEDCVFRTGBNHYUJMKIOLP";
     // Определяем количество символов в $chars
     $size = StrLen($chars) - 1;
     // Определяем пустую переменную, в которую и будем записывать символы.
     $password = null;
     // Создаём пароль.
     while ($maxChars--) {
         $password .= $chars[rand(0, $size)];
     }
     return $password;
 }
开发者ID:netandreus,项目名称:exlibris,代码行数:16,代码来源:Abstract.php

示例13: FLAP_Explode

function FLAP_Explode($String)
{
    /****************************************************************************/
    $__args_types = array('string');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    if (StrLen($String) < 6) {
        return FALSE;
    }
    #-----------------------------------------------------------------------------
    return array('Chanel' => Bytes_Get($String, 01), 'Number' => Bytes_Get($String, 02, 02), 'Data' => SubStr($String, 06));
}
开发者ID:carriercomm,项目名称:jbs,代码行数:14,代码来源:FLAP.php

示例14: SaXoro

function SaXoro($s, $key)
{
    $n = 0;
    for ($f = 0; $f < strlen($s); $f++) {
        if ($s[$f] != $key[$n]) {
            $s[$f] = Chr(ord($s[$f]) ^ ord($key[$n]));
        }
        $n = $n + 1;
        if ($n >= StrLen($key)) {
            $n = 0;
        }
    }
    return $s;
}
开发者ID:tetratec,项目名称:runescape-classic-dump,代码行数:14,代码来源:crypto.php

示例15: RequireAutoloadClass

	static function RequireAutoloadClass($className)
	{
		$className = Trim($className);
		if (StrLen($className) <= 0)
			return False;

		$className = strtolower($className);

		if (array_key_exists($className, $GLOBALS["arBitrixModuleClasses"]))
		{
			require_once($_SERVER["DOCUMENT_ROOT"].((StrLen($GLOBALS["arBitrixModuleClasses"][$className]["module"]) > 0) ? BX_ROOT."/modules/".$GLOBALS["arBitrixModuleClasses"][$className]["module"]."/" : "").$GLOBALS["arBitrixModuleClasses"][$className]["file"]);
			return True;
		}

		return False;
	}
开发者ID:nProfessor,项目名称:Mytb,代码行数:16,代码来源:module.php


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