当前位置: 首页>>代码示例>>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;未经允许,请勿转载。