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


PHP mask函数代码示例

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


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

示例1: getISSN

 /**
  * Returns the ISSN number.
  * 
  * @param bool $mask Mask number?
  * @return string
  */
 public function getISSN($mask = false)
 {
     $issn = $this->issn;
     if ($mask) {
         $issn = \mask('####-####', $issn);
     }
     return $issn;
 }
开发者ID:rafsalvioni,项目名称:zeus-barcode,代码行数:14,代码来源:ISSN.php

示例2: getISBN

 /**
  * Return the ISBN number, masked or not.
  * 
  * @param bool $mask Mask number?
  * @return string
  */
 public function getISBN($mask = false)
 {
     $isbn = $this->getData();
     if ($mask) {
         $isbn = \mask('###-##-###-####-#', $isbn);
     }
     return $isbn;
 }
开发者ID:rafsalvioni,项目名称:zeus-barcode,代码行数:14,代码来源:ISBN.php

示例3: send_message

function send_message($msg)
{
    global $clients;
    $msgFormat = mask(json_encode($msg));
    $msgLength = strlen($msgFormat);
    echo "Send JSON: " . $msgFormat . "\n";
    echo "Length JSON: " . $msgLength . "\n";
    echo "\n*******************************\n";
    foreach ($clients as $changed_socket) {
        @socket_write($changed_socket, $msgFormat, $msgLength);
    }
    return true;
}
开发者ID:kayo-almeida,项目名称:web-sockets,代码行数:13,代码来源:server.php

示例4: query_with_mask

function query_with_mask($sql)
{
    $mask_data = [];
    $result = query($sql);
    foreach ($result['data'] as $row) {
        $mask_row = [];
        foreach ($result['fields'] as $field) {
            $mask_row[$field->name] = mask($field->orgtable, $field->orgname, $row[$field->name]);
        }
        $mask_data[] = $mask_row;
    }
    $result['data'] = $mask_data;
    return $result;
}
开发者ID:github-ai,项目名称:mnw,代码行数:14,代码来源:query_with_mask.php

示例5: createOrder

 public function createOrder($sort, $desc)
 {
     return mask($sort) . ($desc ? ' DESC' : ' ASC');
 }
开发者ID:dapepe,项目名称:tymio,代码行数:4,代码来源:db.php

示例6: unset

        echo "Client[{$address}] connected to us on port {$port}\n";
        //make room for new socket
        unset($changed[$found_socket]);
    }
    //loop through all connected sockets
    foreach ($changed as $changed_socket) {
        //check for any incomming data
        while (socket_recv($changed_socket, $buf, 1024, 0) >= 1) {
            $received_text = unmask($buf);
            //unmask data
            $received = explode(',', $received_text);
            if (!empty($received[1])) {
                echo $received[0] . "\t" . $received[1] . "\n";
                if (array_search($received[0], $address_clients)) {
                    $found_socket = array_search($received[0], $address_clients);
                    socket_write($clients[$found_socket], mask($received[1]), strlen(mask($received[1])));
                }
            }
            break 2;
            //exit this loop
        }
        $buf = socket_read($changed_socket, 1024, PHP_NORMAL_READ);
        if ($buf === false) {
            // remove client for $clients array
            $found_socket = array_search($changed_socket, $clients);
            socket_getpeername($clients[$found_socket], $address);
            unset($clients[$found_socket]);
            echo "Client[{$address}] disconnected\n";
        }
    }
}
开发者ID:sourabh2k15,项目名称:socketmessenger,代码行数:31,代码来源:socketserver.php

示例7: COUNT

    echo "  " . $argv[0] . " HOST --auto\r\n";
    echo "  " . $argv[0] . " www.shopwaredemo.de --auto\r\n\r\n";
    echo "  " . $argv[0] . " HOST QUERY\r\n";
    echo "  " . $argv[0] . " www.shopwaredemo.de \"SELECT COUNT(`id`) FROM `s_user`\"\r\n";
    echo "  " . $argv[0] . " www.shopwaredemo.de \"SELECT `email` FROM `s_user` LIMIT 0,1\"\r\n\r\n";
    exit(1);
}
if ($argv[2] != '--auto') {
    $x = http_req($argv[1], $argv[2]);
    if (!($x = mask($x))) {
        exit("Your query failed!\r\n\r\n");
    }
    echo "Query:\r\n  " . $argv[2] . "\r\nReturn:\r\n  " . $x . "\r\n\r\n";
} else {
    $task = array(array('Amount of registered users', 'SELECT COUNT(`id`) FROM `s_user`', null), array('E- Mail from first user', 'SELECT `email` FROM `s_user` ORDER BY `id` LIMIT 0,1', null), array('Password from first user', 'SELECT `password` FROM `s_user` LIMIT 0,1', null), array('Amount of orders', 'SELECT COUNT(`id`) FROM `s_order`', null));
    for ($i = 0; $i < count($task); $i++) {
        echo "[ .. ] Task: \"" . $task[$i][0] . "\"";
        $x = http_req($argv[1], $task[$i][1]);
        if (!($x = mask($x))) {
            echo "\r[fail] Task: \"" . $task[$i][0] . "\"\r\n";
        } else {
            echo "\r[ ok ] Task: \"" . $task[$i][0] . "\"\r\n";
            $task[$i][2] = $x;
        }
    }
    echo "\r\n";
    for ($i = 0; $i < count($task); $i++) {
        echo $task[$i][0] . space(26 - strlen($task[$i][0])) . ' : ' . $task[$i][2] . "\r\n";
    }
    echo "\r\n";
}
开发者ID:SuperQcheng,项目名称:exploit-database,代码行数:31,代码来源:19825.php

示例8: mask

// [69] => 840.40
// [tot_venctos] => 840.40
// [70] => 788.00
// [bc_sal_fam] => 788.00
// [71] => 724.96
// [bc_irrf] => 724.96
// [72] => 788.00
// [bc_previd] => 788.00
// [73] => PAGAMENTO/QUITAÇÃO NÃO INFORMADO
// [pagto_quitacao] => PAGAMENTO/QUITAÇÃO NÃO INFORMADO
$obj['cnpj_ug'] = mask($obj['cnpj_ug'], '##.###.###/####-##');
$strAnoMes = $obj['ano_mes'];
$obj['ano_mes'] = mes(substr($ano_mes, 4, 2)) . "/" . substr($ano_mes, 0, 4);
$obj['dt_admissao'] = dateFormat($obj['dt_admissao']);
$obj['cpf'] = mask($obj['cpf'], '###.###.###-##');
$obj['pis_pasep'] = mask($obj['pis_pasep'], '###.#####.##-#');
$obj['tot_venctos'] = valorM($obj['tot_venctos']);
$obj['sal_liquido'] = valorM($obj['sal_liquido']);
$obj['tot_descontos'] = valorM($obj['tot_descontos']);
$obj['vencto_base_cargo'] = valorM(substr($obj['vencto_base_cargo'], 0, -2));
$obj['tipo_salario'] = $obj['tipo_salario'] == 1 ? " MENSAL" : " HORA/AULA";
$obj['bc_previd'] = valorM($obj['bc_previd']);
$obj['bc_irrf'] = valorM($obj['bc_irrf']);
$obj['qtd_depend_irrf'] = valorM($obj['qtd_depend_irrf']);
$obj['tot_deduc_depend'] = valorM($obj['tot_deduc_depend']);
$obj['sal_liquido'] = valorM($obj['sal_liquido']);
$obj['vencimentoV'] = vencimento("V", $cli_id, $strAnoMes, 0, $id_servidor);
$obj['vencimentoD'] = vencimento("D", $cli_id, $strAnoMes, 0, $id_servidor);
$tplRelatorio = file_get_contents('relatorioTpl.html');
// echo 'Obj: <pre>';print_r( $obj );die;
$keys = getKeysDados($obj);
开发者ID:hsnunes,项目名称:rhtransparencia,代码行数:31,代码来源:relatorio.php

示例9: socket_read

        $clients[] = $socket_new;
        $header = socket_read($socket_new, 1024);
        //握手
        perform_handshaking($header, $socket_new, $host, $port);
        $found_socket = array_search($socket, $changed);
        unset($changed[$found_socket]);
    }
    foreach ($changed as $changed_socket) {
        $read = '';
        while (socket_recv($changed_socket, $buf, 1024, 0) > 0) {
            $read .= $buf;
        }
        if (!empty($read) && preg_match('/\\[socket_log_start\\]([\\s\\S]*)\\[socket_log_end\\]/', $read, $match)) {
            $read = $match[1];
            echo '#######get the log:' . PHP_EOL . $read . PHP_EOL . PHP_EOL;
            send_message(mask($read));
        }
        $buf = @socket_read($changed_socket, 1024, PHP_NORMAL_READ);
        if ($buf === false) {
            //断开连接
            $found_socket = array_search($changed_socket, $clients);
            unset($clients[$found_socket]);
        }
    }
}
socket_close($sock);
function send_message($msg)
{
    global $clients;
    foreach ($clients as $changed_socket) {
        @socket_write($changed_socket, $msg, strlen($msg));
开发者ID:reedboat,项目名称:applib,代码行数:31,代码来源:SocketLog.server.php

示例10: movePiece

 function movePiece($playerNum, $from, $to)
 {
     // Verify player controls the piece
     echo "Player " . $playerNum . " making a move " . $from . " --> " . $to . "\n";
     //print_r($this->boardSpots);
     //$toIndex = $to[0] + $to[1]*10;
     $toY = floor($to / 10);
     $toX = $to - $toY * 10;
     $movedPiece = $this->boardSpots[$from];
     $trgPiece = $this->boardSpots[$to];
     if ($this->unitRanks[$movedPiece] > 10) {
         echo "invalid piece\n";
         $response_text = mask(json_encode(array('type' => 'gameMessage', 'message' => 'can\'t move this piece')));
         send_message_group($response_text, [$this->sockets[$playerNum]]);
         //send data
         return;
     }
     if ($this->turn != $playerNum) {
         echo "wront turn\n";
         $response_text = mask(json_encode(array('type' => 'gameMessage', 'message' => 'It is not your turn')));
         send_message_group($response_text, [$this->sockets[$playerNum]]);
         //send data
         return;
     }
     if (floor($movedPiece / 40) + 1 == $playerNum) {
         // Check target location to see if it is a valid move
         echo "You can move this one\n";
         if (abs($from - $to) == 10 || abs($from - $to) == 1) {
             // This is a valid one space move -> now verify that it is a move to able spot
             echo "valid move\n";
             $spotCheck = floor($trgPiece / 40) + 1;
             switch ($spotCheck) {
                 case $playerNum:
                     echo "Can't move onto your own piece(" . $movedPiece . " vs " . $trgPiece . ")\n";
                     break;
                 case $this->opponentSwitch[$playerNum]:
                     print_r($this->unitRanks);
                     echo "Move onto an opponents piece ID: (" . $movedPiece . " vs " . $trgPiece . ") ranks (" . $this->unitRanks[$movedPiece] . " vs " . $this->unitRanks[$trgPiece] . ")\n";
                     // Review outcome of piece collision
                     $outCome = resolveCollision($movedPiece, $trgPiece, $this->unitRanks);
                     $this->turn = $this->opponentSwitch[$playerNum];
                     switch ($outCome) {
                         case 1:
                             $this->kill($to, $trgPiece);
                             $this->processMove($from, $to, $movedPiece);
                             $response_text = mask(json_encode(array('type' => 'script', 'message' => 'killPiece(' . $to . ');showMove(' . $from . ', ' . $to . ', [' . $toX . ', ' . $toY . ']);')));
                             break;
                         case 2:
                             $this->kill($from, $movedPiece);
                             $response_text = mask(json_encode(array('type' => 'script', 'message' => 'killPiece(' . $from . ');')));
                             break;
                         case 3:
                             $this->kill($to, $trgPiece);
                             $this->kill($from, $movedPiece);
                             $response_text = mask(json_encode(array('type' => 'script', 'message' => 'killPiece(' . $to . ');killPiece(' . $from . ');sync([' . implode(",", $this->unitLocs) . '], [' . implode(",", $this->unitStatus) . ']);')));
                             break;
                         case 4:
                             echo "A winner is you!";
                             $response_text = mask(json_encode(array('type' => 'gameMessage', 'message' => 'Player ' . $playerNum . ' - A WINNER IS YOU!')));
                             send_message($response_text);
                             //send data
                             break;
                         default:
                             echo "an error has occured";
                             $response_text = mask(json_encode(array('type' => 'gameMessage', 'message' => 'it broke')));
                             send_message($response_text);
                             //send data
                             break;
                     }
                     send_message($response_text);
                     //send data
                     break;
                 case 3:
                     $this->turn = $this->opponentSwitch[$playerNum];
                     echo "move to an empty spot\n";
                     $this->processMove($from, $to, $movedPiece);
                     $response_text = mask(json_encode(array('type' => 'script', 'message' => 'showMove(' . $from . ', ' . $to . ', [' . $toX . ', ' . $toY . ']);')));
                     send_message($response_text);
                     //send data
                     break;
                 case 4:
                     echo "move to a closed tile\n";
                     break;
             }
         } else {
             echo "invalid move (" . ($from - $to) . ")\n";
             $response_text = mask(json_encode(array('type' => 'gameMessage', 'message' => 'invalid move')));
             send_message_group($response_text, [$this->sockets[$playerNum]]);
             //send data
         }
     } else {
         echo "you no control this one " . $movedPiece . " vs " . $playerNum . "\n";
     }
 }
开发者ID:rwruss,项目名称:ib3,代码行数:94,代码来源:stratego.php

示例11: sendMessage

function sendMessage($msg, $user = null, $channel = null)
{
    terminal('MESSAGE OUT', $msg);
    //get global for users arrays
    global $clients, $users, $db;
    //Send for ALL
    if ($user == null) {
        foreach ($clients as $k => $v) {
            if (isset($users[$k]['channel']) && $users[$k]['channel'] == $channel && isset($users[$k]['userid'])) {
                $tmp = mask($db->encMSG(json_encode($msg), $users[$k]['userid']));
                socket_write($v, $tmp, strlen($tmp));
            }
        }
    } elseif (is_resource($clients[$user])) {
        $tmp = mask($db->encMSG(json_encode($msg), $users[$user]['userid']));
        socket_write($clients[$user], $tmp, strlen($tmp));
    }
}
开发者ID:pedra,项目名称:Xhat,代码行数:18,代码来源:relay.php

示例12: mask

            //Cor da mensagem
            //Prepara a mensagem para enviar para os clients
            $response_text = mask(json_encode(array('type' => 'usermsg', 'name' => $user_name, 'message' => $user_message, 'color' => $user_color)));
            send_message($response_text);
            //Envia a mensagem
            break 2;
            //Sai do loop
        }
        $buf = @socket_read($changed_socket, 1024, PHP_NORMAL_READ);
        if ($buf === false) {
            //Remove o client do array $clients
            $found_socket = array_search($changed_socket, $clients);
            socket_getpeername($changed_socket, $ip);
            unset($clients[$found_socket]);
            //Notifica todos os usuários da conexão encerrada
            $response = mask(json_encode(array('type' => 'system', 'message' => $ip . ' desconectado')));
            send_message($response);
        }
    }
}
//Fecha o socket
socket_close($sock);
function send_message($msg)
{
    global $clients;
    foreach ($clients as $changed_socket) {
        @socket_write($changed_socket, $msg, strlen($msg));
    }
    return true;
}
//Decodifica uma mensagem
开发者ID:mserses,项目名称:online-chat,代码行数:31,代码来源:server.php

示例13: estadoCivil

 $Nome = $verifica['Nome'];
 $NomeArtistico = $verifica['Nome_Art'];
 $RG = $verifica['RG'];
 $CPF = $cpf_tbl;
 $CCM = $verifica['CCM'];
 $IdEstadoCivil = estadoCivil($verifica['Est_Civ']);
 //funcao para verificar
 if ($verifica['D_nasc'] == NULL) {
     $DataNascimento == NULL;
 } else {
     $DataNascimento = exibirDataMysql($verifica['D_nasc']);
     //funcao para data em mysql
 }
 $LocalNascimento = $verifica['Loc_Nasc'];
 $Nacionalidade = "Brasileiro(a)";
 $CEP = mask($verifica['Cep'], '#####-###');
 $Telefone1 = $verifica['Telefone'];
 $Telefone2 = $verifica['Telefon2'];
 $Telefone3 = $verifica['Telefon3'];
 $Email = $verifica['Email'];
 $DRT = $verifica['DRT'];
 $Pis = $verifica['Pis'];
 $DataAtualizacao = date('Y-m-d');
 $Observacao = $verifica['Endereco'] . "\n" . $verifica['Regiao'] . "\n" . $verifica['currric'] . "\n" . $verifica['Grau_Ins'] . "\n";
 $tipoDocumento = "1";
 $sql_insere_cpf = "INSERT INTO `sis_pessoa_fisica` \r\n\t\t(`Nome`, `NomeArtistico`, `RG`, `CPF`, `CCM`, `IdEstadoCivil`, `DataNascimento`, `LocalNascimento`, `Nacionalidade`, `CEP`,  `Telefone1`, `Telefone2`, `Telefone3`, `Email`, `DRT`,  `Pis`,  `DataAtualizacao`, `Observacao`) VALUES ('{$Nome}', '{$NomeArtistico}', '{$RG}', '{$cpf_tbl}', '{$CCM}', '{$IdEstadoCivil}' ,{$DataNascimento}, '{$LocalNascimento}', '{$Nacionalidade}','{$CEP}', '{$Telefone1}', '{$Telefone2}', '{$Telefone3}', '{$Email}', '{$DRT}', '{$Pis}',  '{$DataAtualizacao}', '{$Observacao}')";
 $query_insere_cpf = mysqli_query($con, $sql_insere_cpf);
 if ($query_insere_cpf) {
     $texto .= "O CPF {$cpf_tbl} foi inserido com sucesso no sistema.<br />";
 } else {
     $texto .= "Erro ao inserir CPF {$cpf_tbl} no sistema.<br />";
开发者ID:marcioyonamine,项目名称:igsisv1,代码行数:31,代码来源:admin.php

示例14: ord

                   for ($i = 0; $i < strlen($buffer); $i++) {
                       echo ord($buffer[$i]).',';
                   }
                   echo "\n";
                   */
                if ($bytes === false || (ord($buffer[0]) & 15) == 8) {
                    ## 연결종료 ###########################################
                    unset($socket_list[$addr_port]);
                    unset($handshake_check[$addr_port]);
                    socket_close($read_socket);
                    echo "<{$addr_port}>[Close]\n";
                    #####################################################
                } else {
                    ## 메시지전달 ##########################################
                    $msg = unmask($buffer);
                    $echo_msg = mask("ECHO: {$msg}");
                    socket_write($read_socket, $echo_msg);
                    echo "<{$addr_port}>: {$msg}\n";
                    #####################################################
                }
            }
            // end if
        }
        // end if
    }
    // end foreach
}
// end while
function parse_header($str)
{
    $str = preg_replace('/\\r/', '', $str);
开发者ID:eunicon,项目名称:meetup,代码行数:31,代码来源:server.php

示例15: socket_getpeername

        socket_getpeername($socket_new, $ip);
        Log::writeLog("Client " . $ip . " connected\n", true);
        $response = mask(json_encode(array('server' => $ip . ' connected')));
        send_message($response);
        send_message(mask(json_encode($IO->generateNewClientPacket())));
        $found_socket = array_search($socket, $changed);
        unset($changed[$found_socket]);
    }
    foreach ($changed as $changed_socket) {
        while (socket_recv($changed_socket, $buf, 1024, 0) >= 1) {
            $received_text = unmask($buf);
            $jsonObject = json_decode($received_text);
            $createResponse = json_encode(array('server' => $ip . ' : ' . utf8_encode($received_text)));
            Log::writeLog($received_text . "\r\n", true);
            $IO->parse($received_text);
            $response_text = mask($createResponse);
            send_message($response_text);
            break 2;
        }
        $buf = @socket_read($changed_socket, 1024, PHP_NORMAL_READ);
        if ($buf === false) {
            $found_socket = array_search($changed_socket, $clients);
            socket_getpeername($changed_socket, $ip);
            unset($clients[$found_socket]);
            $response = mask(json_encode(array('server' => $ip . ' disconnected')));
            send_message($response);
        }
    }
}
Log::closeLog();
socket_close($socket);
开发者ID:agupta231,项目名称:Pi-Room,代码行数:31,代码来源:Server.php


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