當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CHR函數代碼示例

本文整理匯總了PHP中CHR函數的典型用法代碼示例。如果您正苦於以下問題:PHP CHR函數的具體用法?PHP CHR怎麽用?PHP CHR使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CHR函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ENCRYPT_DECRYPT

function ENCRYPT_DECRYPT($Str_Message)
{
    //Function : encrypt/decrypt a string message v.1.0  without a known key
    //Author   : Aitor Solozabal Merino (spain)
    //Email    : aitor-3@euskalnet.net
    //Date     : 01-04-2005
    $Len_Str_Message = STRLEN($Str_Message);
    $Str_Encrypted_Message = "";
    for ($Position = 0; $Position < $Len_Str_Message; $Position++) {
        // long code of the function to explain the algoritm
        //this function can be tailored by the programmer modifyng the formula
        //to calculate the key to use for every character in the string.
        $Key_To_Use = $Len_Str_Message + $Position + 1;
        // (+5 or *3 or ^2)
        //after that we need a module division because can´t be greater than 255
        $Key_To_Use = (255 + $Key_To_Use) % 255;
        $Byte_To_Be_Encrypted = SUBSTR($Str_Message, $Position, 1);
        $Ascii_Num_Byte_To_Encrypt = ORD($Byte_To_Be_Encrypted);
        $Xored_Byte = $Ascii_Num_Byte_To_Encrypt ^ $Key_To_Use;
        //xor operation
        $Encrypted_Byte = CHR($Xored_Byte);
        $Str_Encrypted_Message .= $Encrypted_Byte;
        //short code of  the function once explained
        //$str_encrypted_message .= chr((ord(substr($str_message, $position, 1))) ^ ((255+(($len_str_message+$position)+1)) % 255));
    }
    return $Str_Encrypted_Message;
}
開發者ID:utilo-web-app-development,項目名稱:REZERVI,代碼行數:27,代碼來源:benutzerFunctions.inc.php

示例2: conversion

function conversion($s)
{
    $n = str_replace(CHR(32), "", $s);
    $array = array(1, 2, 3, 4, 5, 6);
    $array1 = array("goodmorning", "goodafternoon", "goodevening", "goodnight", "goodbye", "thankyou");
    echo $conversion = str_replace($array1, $array, $n);
}
開發者ID:mysteriou,項目名稱:educafacile.com,代碼行數:7,代碼來源:conversionvocabulaire.php

示例3: stripLines

 public static function stripLines($text)
 {
     $text = str_replace(CHR(10), "", $text);
     // et celle là aussi :
     $text = str_replace(CHR(13), "", $text);
     return $text;
 }
開發者ID:demental,項目名稱:m,代碼行數:7,代碼來源:Strings.php

示例4: bin2text

 function bin2text($bin_str)
 {
     $text_str = '';
     $chars = EXPLODE("\n", CHUNK_SPLIT(STR_REPLACE("\n", '', $bin_str), 8));
     $_I = COUNT($chars);
     for ($i = 0; $i < $_I; $text_str .= CHR(BINDEC($chars[$i])), $i) {
     }
     return $text_str;
 }
開發者ID:nuukcillo,項目名稱:MusicBox-,代碼行數:9,代碼來源:mp3read.php

示例5: isExcluded

function isExcluded($url)
{
    global $exclusions;
    foreach (explode(CHR(13) . CHR(10), $exclusions) as $e) {
        $e = trim(preg_replace('/\\s+/', ' ', $e));
        if (strpos($url, $e) !== false) {
            return true;
        }
    }
    return false;
}
開發者ID:smaranda,項目名稱:linkschecker,代碼行數:11,代碼來源:locallib.php

示例6: decrypt

 public function decrypt($string)
 {
     $ivArray = array(0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef);
     $iv = null;
     foreach ($ivArray as $element) {
         $iv .= CHR($element);
     }
     $string = base64_decode($string);
     $result = mcrypt_decrypt(MCRYPT_DES, $this->key, $string, MCRYPT_MODE_CBC, $iv);
     $result = $this->pkcs5Unpad($result);
     return $result;
 }
開發者ID:medz,項目名稱:thinksns-4,代碼行數:12,代碼來源:DES_MOBILE.php

示例7: Formulaires_CSV

function Formulaires_CSV($data_in = array())
{
    Lib_myLog("action: " . $data_in['action']);
    foreach ($GLOBALS['tab_globals'] as $global) {
        global ${$global};
    }
    Lib_myLog("IN: ", $data_in);
    Lib_myLog("FILE: ", __FILE__);
    /*=============*/
    Lib_myLog("Impression de la liste en CSV");
    $time = time();
    $filename = $data_in['form'] . "_" . $time . ".xls";
    $file = '../dilasys/tmp/' . $filename;
    // le fichier doit déjà exister
    if (!($myfile = fopen($file, "w"))) {
        /*=============*/
        Lib_myLog("Erreur lors de la creation du fichier {$file}");
        exit;
    } else {
        /*=============*/
        Lib_myLog("Creation du fichier {$file}");
    }
    $intitules = array("Nom", "Prénom", "Email", "Donneé1", "Donnée2");
    foreach ($intitules as $intitule) {
        $header .= $intitule . "\t ";
    }
    $header .= "\n";
    fputs($myfile, $header);
    $body = '';
    $liste_tmp = Forms_chercher('*');
    foreach ($liste_tmp as $tmp) {
        $body .= utf8_decode($tmp['nom']) . "\t ";
        $body .= utf8_decode($tmp['prenom']) . "\t ";
        for ($id = 1; $id <= 8; $id++) {
            $body .= str_replace(CHR(13) . CHR(10), " ", utf8_decode($tmp['form' . $id])) . "\t ";
        }
        $body .= "\n";
    }
    fputs($myfile, $body);
    fclose($myfile);
    //on ferme le fichier
    $size = filesize($file);
    header("Content-Type: application/octet-stream");
    header("Content-Length: {$size}");
    header("Content-Disposition: attachment; filename=" . $filename);
    header("Content-Transfer-Encoding: binary");
    $fh = fopen($file, "r");
    fpassthru($fh);
}
開發者ID:xVirusproj3ct,項目名稱:site_web_phf,代碼行數:49,代碼來源:actions_formulaires.php

示例8: UnFilterHtml

function UnFilterHtml($Str)
{
    $Str = str_Replace("<br/>", CHR(10), $Str);
    $Str = str_Replace("<br />", chr(10), $Str);
    $Str = str_Replace("", CHR(13), $Str);
    $Str = str_Replace("&#39;", CHR(39), $Str);
    $Str = str_Replace("&quot;", CHR(34), $Str);
    $Str = str_Replace("&nbsp;", CHR(9), $Str);
    $Str = str_Replace("&nbsp;", CHR(32), $Str);
    $Str = str_Replace("&lt;", "<", $Str);
    $Str = str_Replace("&gt;", ">", $Str);
    $Str = str_Replace("&amp;", "&", $Str);
    $Str = str_Replace("&acute;", "'", $Str);
    $Str = str_Replace("&#44", ",", $Str);
    return $Str;
}
開發者ID:a195474368,項目名稱:ejw,代碼行數:16,代碼來源:filter.php

示例9: HTMLDecode

function HTMLDecode($str)
{
    if (!empty($str)) {
        $str = str_replace("&amp;", "&", $str);
        $str = str_replace("&gt;", ">", $str);
        $str = str_replace("&lt;", "<", $str);
        $str = str_replace("&nbsp;", CHR(32), $str);
        $str = str_replace("&nbsp;&nbsp;&nbsp;&nbsp;", CHR(9), $str);
        $str = str_replace("&#160;&#160;&#160;&#160;", CHR(9), $str);
        $str = str_replace("&quot;", CHR(34), $str);
        $str = str_replace("&#39;", CHR(39), $str);
        $str = str_replace("", CHR(13), $str);
        $str = str_replace("<br/>", CHR(10), $str);
        $str = str_replace("<br>", CHR(10), $str);
    }
    return $str;
}
開發者ID:htom78,項目名稱:project,代碼行數:17,代碼來源:inc_function.php

示例10: enregistrerComment

 public static function enregistrerComment($id, $pseudo, $message)
 {
     $nomSite = Config::getVal('nom', 'core/data/');
     $adresseSite = Config::getVal('adresse', 'core/data/');
     $message = str_replace("<", "&lt;", $message);
     $message = str_replace(">", "&gt;", $message);
     $message = str_replace("\\'", "'", $message);
     $message = str_replace('\\"', '"', $message);
     $message = str_replace(CHR(10), "<br>", $message);
     $pseudo = str_replace("<", "&lt;", $pseudo);
     $pseudo = str_replace(">", "&gt;", $pseudo);
     $pseudo = str_replace("\\'", "'", $pseudo);
     $pseudo = str_replace('\\"', '"', $pseudo);
     //date_default_timezone_set('Europe/Paris');
     //$date = date('Y-m-d H\hi');
     $date = time();
     $comment = new Archivable('Commentaire');
     $comment->set('ip', $_SERVER['REMOTE_ADDR']);
     $comment->set('id_article', $id);
     $comment->set('pseudo', $pseudo);
     $comment->set('texte', $message);
     //verification que le commentaire n'a as déja été enregistré
     $arch = new Archiviste(Commentaire::$dbSite);
     $commsTest = $arch->restituer($comment);
     $retour = false;
     if (count($commsTest) == 0) {
         $comment->set('date', $date);
         $arch->archiver($comment);
         //on informe l'admin qu'un commentaire a été posté
         $corps_message = 'Nouveau commentaire de ' . $pseudo . ' (<a href="http://' . $adresseSite . '/?mod=site&art=' . $id . '">lien vers l\'article</a>)' . PHP_EOL . '<br />' . PHP_EOL . $message;
         $headers = 'Content-type: text/html; charset=UTF-8' . "\r\n" . 'From: "' . $nomSite . '"<robot@' . $adresseSite . '>' . "\r\n";
         mail(Config::getVal('mail', 'core/data/'), 'Nouveau commentaire', $corps_message, $headers);
         $retour = true;
     }
     return $retour;
 }
開發者ID:selenith,項目名稱:plasmide,代碼行數:36,代碼來源:Commentaire.php

示例11: ENCRYPT_DECRYPT

 function ENCRYPT_DECRYPT($Str_Message)
 {
     $Len_Str_Message = STRLEN($Str_Message);
     $Str_Encrypted_Message = "";
     for ($Position = 0; $Position < $Len_Str_Message; $Position++) {
         // long code of the function to explain the algoritm
         //this function can be tailored by the programmer modifyng the formula
         //to calculate the key to use for every character in the string.
         $Key_To_Use = ($Len_Str_Message + $Position) * 230;
         // (+5 or *3 or ^2)
         //after that we need a module division because can´t be greater than 255
         //$Key_To_Use = (255+$Key_To_Use) % 255;
         $Key_To_Use = (168 + $Key_To_Use) % 168;
         $Byte_To_Be_Encrypted = SUBSTR($Str_Message, $Position, 1);
         $Ascii_Num_Byte_To_Encrypt = ORD($Byte_To_Be_Encrypted);
         $Xored_Byte = $Ascii_Num_Byte_To_Encrypt ^ $Key_To_Use;
         //xor operation
         $Encrypted_Byte = CHR($Xored_Byte);
         $Str_Encrypted_Message .= $Encrypted_Byte;
         //short code of  the function once explained
         //$str_encrypted_message .= chr((ord(substr($str_message, $position, 1))) ^ ((255+(($len_str_message+$position)+1)) % 255));
     }
     return $Str_Encrypted_Message;
 }
開發者ID:rickyx12,項目名稱:mendero,代碼行數:24,代碼來源:myDatabase_04252014.php

示例12: array

<?php

include "verification.php";
$id = $_GET['id'];
$form = $_GET['form'];
$tab = array(CHR(13) => " ", CHR(10) => " ");
//si un menu et un seul doit être retourné
if ($id > 0) {
    $sqliste = "SELECT * FROM utilisateurs.t_menus\n\t\tWHERE id_menu={$id}";
} else {
    $sqliste = "SELECT * FROM utilisateurs.t_menus";
}
$result = pg_query($sqliste) or die('Échec requête : ' . pg_last_error());
$nb = pg_numrows($result);
$json = "[";
$i = 0;
while ($val = pg_fetch_assoc($result)) {
    $id_menu = $val['id_menu'];
    $nom_menu = str_replace("'", "\\'", $val['nom_menu']);
    $desc_menu = str_replace("'", "\\'", $val['desc_menu']);
    $desc_menu = strtr($desc_menu, $tab);
    $id_application = $val['id_application'];
    $text = "{id_menu:" . $id_menu . ",nom_menu:'" . $nom_menu . "',desc_menu:'" . $desc_menu . "',id_application:" . $id_application . "}";
    $json = $json . $text;
    $i++;
    if ($i > 0 and $i != $nb) {
        $json = $json . ",";
    }
}
$json = $json . "]";
if ($form) {
開發者ID:ClaireLagaye,項目名稱:UsersHub,代碼行數:31,代碼來源:get_menus.php

示例13: foreach

<?php

$pathBatch = "../../";
include $pathBatch . "init_pages/" . "batch.php";
//echoa($_REQUEST);
foreach ($myAdmin->LIST_LANG_DATAS as $clg => $nlg) {
    $mySelect = new mySelect(__FILE__);
    $mySelect->tables = $thisSite->PREFIXE_TBL_CLI . "itineraires_texte";
    $mySelect->where = "id=" . $_GET["id"] . " AND lg='" . $clg . "'";
    $result = $mySelect->query();
    $row = current($result);
    $row["texte"] = str_replace("\n", "", $row["texte"]);
    $row["texte"] = str_replace("\r\n", "", $row["texte"]);
    $row["texte"] = str_replace("\r", "", $row["texte"]);
    $row["texte"] = str_replace(CHR(10), "", $row["texte"]);
    $row["texte"] = str_replace(CHR(13), "", $row["texte"]);
    if ($row["id"] > 0) {
        echo "\$('#idCurrent').val('" . $row["id"] . "');\n";
        echo "\$('#titre_" . $clg . "').val(\"" . addslashes($row["titre"]) . "\");\n";
        echo "\$('#type_texte').val(\"" . addslashes($row["type_texte"]) . "\");\n";
        echo "tinyMCE.get('texte_" . $clg . "').setContent(\"" . addslashes($row["texte"]) . "\");\n";
    }
}
?>
 
開發者ID:wedesign-pf,項目名稱:Tit,代碼行數:24,代碼來源:ajax_load_texte_itineraire.php

示例14: textWithHole

 /**
  * Text with hole.
  */
 private function textWithHole()
 {
     $textEntryInteraction = '';
     $newId = 1;
     $html = htmlspecialchars_decode($this->interactionhole->getHtmlWithoutValue());
     //delete the line break in $html
     $html = str_replace(CHR(10), '', $html);
     $html = str_replace(CHR(13), '', $html);
     $html = html_entity_decode($html);
     $regex = '(<input.*?class="blank".*?>|<select.*?class="blank".*?>.*?</select>)';
     preg_match_all($regex, $html, $matches);
     foreach ($matches[0] as $matche) {
         $tabMatche = explode('"', $matche);
         $id = $tabMatche[1];
         if (substr($matche, 1, 5) == 'input') {
             //hole with input element
             $name = $tabMatche[7];
             $size = $tabMatche[9];
             $textEntryInteraction = str_replace('input', 'textEntryInteraction', $matche);
             $textEntryInteraction = str_replace('class="blank" ', '', $textEntryInteraction);
             $textEntryInteraction = str_replace('type="text" ', '', $textEntryInteraction);
             $textEntryInteraction = str_replace('value="" ', '', $textEntryInteraction);
             $textEntryInteraction = str_replace('id="' . $id . '"', 'responseIdentifier="blank_' . $newId . '"', $textEntryInteraction);
             $textEntryInteraction = str_replace('name="' . $name . '"', '', $textEntryInteraction);
             $textEntryInteraction = str_replace('autocomplete="off"', '', $textEntryInteraction);
             $textEntryInteraction = str_replace('size="' . $size . '"', 'expectedLength="' . $size . '"', $textEntryInteraction);
         } else {
             //hole with select element
             $name = $tabMatche[5];
             $textEntryInteraction = str_replace('</select>', '</inlineChoiceInteraction>', $matche);
             $textEntryInteraction = str_replace('select', 'inlineChoiceInteraction', $textEntryInteraction);
             $textEntryInteraction = str_replace('id="' . $id . '"', 'responseIdentifier="blank_' . $newId . '"', $textEntryInteraction);
             $textEntryInteraction = str_replace('class="blank" ', '', $textEntryInteraction);
             $textEntryInteraction = str_replace('name="' . $name . '"', '', $textEntryInteraction);
             $textEntryInteraction = str_replace('option', 'inlineChoice', $textEntryInteraction);
             //for the option elements
             $regexOpt = '(<inlineChoice value=.*?>)';
             preg_match_all($regexOpt, $textEntryInteraction, $matchesOpt);
             foreach ($matchesOpt[0] as $matcheOpt) {
                 $tabMatcheOpt = explode('"', $matcheOpt);
                 $holeID = $tabMatcheOpt[1];
                 $opt = str_replace('value="' . $holeID . '"', 'identifier="choice_' . $holeID . '"', $matcheOpt);
                 $textEntryInteraction = str_replace($matcheOpt, $opt, $textEntryInteraction);
             }
         }
         $textEntryInteraction = str_replace('&nbsp;', ' ', $textEntryInteraction);
         $html = str_replace($matche, $textEntryInteraction, $html);
         ++$newId;
     }
     //For the question created before the 2014/10/09
     $html = str_replace('</select>', '', $html);
     $fragment = $this->document->createDocumentFragment();
     $fragment->appendXML($html);
     $this->itemBody->appendChild($fragment);
     $this->imgToObject($this->document);
     $this->aToObject($this->document);
 }
開發者ID:claroline,項目名稱:distribution,代碼行數:60,代碼來源:HoleExport.php

示例15: format

	
	if (isset($lQueryResult->num_rows)){
		if ($lQueryResult->num_rows > 0) {
			$lResultsFound = TRUE;
			$lRecordsFound = $lQueryResult->num_rows;
		}//end if
	}//end if

	if ($lResultsFound){
		
		echo format("Executed query 'SELECT * FROM accounts'. Found ".$lRecordsFound." records.","S");
		
		$lAccountsXML='<?xml version="1.0" encoding="utf-8"?>'.PHP_EOL;
		$lAccountsXML.="<Employees>".PHP_EOL;
		$lCounter=1;
		$cTAB = CHR(9);
		
		while($row = $lQueryResult->fetch_object()){
			$lAccountType = $row->is_admin?"Admin":"User";
		   	$lAccountsXML.=$cTAB.'<Employee ID="'.$lCounter.'">'.PHP_EOL;
		   	$lAccountsXML.=$cTAB.$cTAB.'<UserName>'.$row->username.'</UserName>'.PHP_EOL;
		   	$lAccountsXML.=$cTAB.$cTAB.'<Password>'.$row->password.'</Password>'.PHP_EOL;
		   	$lAccountsXML.=$cTAB.$cTAB.'<Signature>'.$row->mysignature.'</Signature>'.PHP_EOL;
		   	$lAccountsXML.=$cTAB.$cTAB.'<Type>'.$lAccountType.'</Type>'.PHP_EOL;
		   	$lAccountsXML.=$cTAB.'</Employee>'.PHP_EOL;
		   	
		   	$lAccountsText.=$lCounter.",".$row->username.",".$row->password.",".$row->mysignature.",".$lAccountType.PHP_EOL;
		   	$lCounter+=1;
		}// end while

		$lAccountsXML.="</Employees>".PHP_EOL;
開發者ID:neelaryan,項目名稱:mutillidae,代碼行數:30,代碼來源:set-up-database.php


注:本文中的CHR函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。