• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP ereg_replace函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ImageManipulation

 /**
  * Contructor method. Will create a new image from the target file.
  * Accepts an image filename as a string. Method also works out how
  * big the image is and stores this in the $image array.
  *
  * @param string $imgFile The image filename.
  */
 public function ImageManipulation($imgfile)
 {
     //detect image format
     $this->image["format"] = ereg_replace(".*\\.(.*)\$", "\\1", $imgfile);
     $this->image["format"] = strtoupper($this->image["format"]);
     // convert image into usable format.
     if ($this->image["format"] == "JPG" || $this->image["format"] == "JPEG") {
         //JPEG
         $this->image["format"] = "JPEG";
         $this->image["src"] = ImageCreateFromJPEG($imgfile);
     } elseif ($this->image["format"] == "PNG") {
         //PNG
         $this->image["format"] = "PNG";
         $this->image["src"] = imagecreatefrompng($imgfile);
     } elseif ($this->image["format"] == "GIF") {
         //GIF
         $this->image["format"] = "GIF";
         $this->image["src"] = ImageCreateFromGif($imgfile);
     } elseif ($this->image["format"] == "WBMP") {
         //WBMP
         $this->image["format"] = "WBMP";
         $this->image["src"] = ImageCreateFromWBMP($imgfile);
     } else {
         //DEFAULT
         return false;
     }
     // Image is ok
     $this->imageok = true;
     // Work out image size
     $this->image["sizex"] = imagesx($this->image["src"]);
     $this->image["sizey"] = imagesy($this->image["src"]);
 }
开发者ID:RobAnt,项目名称:GetSimple-Plugins,代码行数:39,代码来源:imagemanipulation.php


示例2: clear_tmpfiles

 function clear_tmpfiles($cachetime = 1800)
 {
     global $GB_TMP;
     $delfiles = 0;
     $filelist = '';
     if (is_dir("{$this->include_path}/{$GB_TMP}")) {
         chdir("{$this->include_path}/{$GB_TMP}");
         $hnd = opendir(".");
         while ($file = readdir($hnd)) {
             if (is_file($file)) {
                 $filelist[] = $file;
             }
         }
         closedir($hnd);
     }
     if (is_array($filelist)) {
         while (list($key, $file) = each($filelist)) {
             $tmpfile = explode(".", $file);
             $tmpfile[0] = ereg_replace("img-", "", $tmpfile[0]);
             if ($tmpfile[0] < time() - $cachetime) {
                 if (unlink($file)) {
                     $delfiles++;
                 }
             }
         }
     }
     return $delfiles;
 }
开发者ID:ssh24,项目名称:LFC-World-fan-website,代码行数:28,代码来源:add.class.php


示例3: build_query_url

 /**
  * 拼接URL
  * @param $uri 可以传入Controller名称
  * @param string $type
  * @param array $params
  * @param bool $toLower 是否需要将uri换成小写
  * @return string
  */
 public static function build_query_url($uri, $params = array(), $toLower = true, $type = "")
 {
     $class_name = ereg_replace('Controller$', '', $uri);
     $arr = explode("_", $class_name);
     if ($toLower) {
         $uri = strtolower(implode("/", $arr));
     } else {
         $uri = implode("/", $arr);
     }
     if (empty($type) && BASE_URI_PRI) {
         $resUri = "/" . BASE_URI_PRI . "/" . ltrim($uri, "/");
     } elseif (empty($type)) {
         $resUri = "/" . ltrim($uri, "/");
     } else {
         $url_type = APF::get_instance()->get_config("domain_type");
         if ($url_type[$type]) {
             $resUri = "/" . $url_type[$type] . "/" . ltrim($uri, "/");
         } else {
             $resUri = "/" . ltrim($uri, "/");
         }
     }
     if (!empty($params) && is_array($params)) {
         $resUri .= "?" . http_build_query($params);
     }
     $base_domain = APF::get_instance()->get_config('base_domain');
     return self::get_protocol_name() . "://" . $base_domain . $resUri;
 }
开发者ID:emilymwang8,项目名称:cms,代码行数:35,代码来源:Url.php


示例4: encodeHTML

function encodeHTML($sHTML)
{
    $sHTML = ereg_replace("&", "&amp;", $sHTML);
    $sHTML = ereg_replace("<", "&lt;", $sHTML);
    $sHTML = ereg_replace(">", "&gt;", $sHTML);
    return $sHTML;
}
开发者ID:jvinhit,项目名称:php,代码行数:7,代码来源:default_toolbar2.php


示例5: formatPH

function formatPH($ph)
{
    $ph = ereg_replace('[^0-9]+', '', $ph);
    // ##### Strip all Non-Numeric Characters
    $phlen = strlen($ph);
    switch (TRUE) {
        case $phlen < 7:
            $ext = $ph;
            break;
        case $phlen == 7:
            sscanf($ph, "%3s%4s", $pfx, $exc);
            break;
        case $phlen > 7 and $phlen < 10:
            sscanf($ph, "%3s%4s%s", $pfx, $exc, $ext);
            break;
        case $phlen == 10:
            sscanf($ph, "%3s%3s%4s", $area, $pfx, $exc);
            break;
        case $phlen == 11:
            sscanf($ph, "%1s%3s%3s%4s", $cty, $area, $pfx, $exc);
            break;
        case $phlen > 11:
            sscanf($ph, "%1s%3s%3s%4s%s", $cty, $area, $pfx, $exc, $ext);
            break;
    }
    $out = '';
    $out .= isset($cty) ? $cty . ' ' : '';
    $out .= isset($area) ? '(' . $area . ') ' : '';
    $out .= isset($pfx) ? $pfx . ' - ' : '';
    $out .= isset($exc) ? $exc . ' ' : '';
    $out .= isset($ext) ? 'x' . $ext : '';
    return $out;
}
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:33,代码来源:phoneformat.php


示例6: lang_load

function lang_load($p_lang)
{
    global $g_lang_strings, $g_active_language;
    $g_active_language = $p_lang;
    if (isset($g_lang_strings[$p_lang])) {
        return;
    }
    if (!lang_language_exists($p_lang)) {
        return;
    }
    $t_lang_dir = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR;
    require_once $t_lang_dir . 'strings_' . $p_lang . '.txt';
    # Allow overriding strings declared in the language file.
    # custom_strings_inc.php can use $g_active_language
    $t_custom_strings = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'custom_strings_inc.php';
    if (file_exists($t_custom_strings)) {
        require $t_custom_strings;
        # this may be loaded multiple times, once per language
    }
    $t_vars = get_defined_vars();
    foreach (array_keys($t_vars) as $t_var) {
        $t_lang_var = ereg_replace('^s_', '', $t_var);
        if ($t_lang_var != $t_var || 'MANTIS_ERROR' == $t_var) {
            $g_lang_strings[$p_lang][$t_lang_var] = ${$t_var};
        }
    }
}
开发者ID:amjadtbssm,项目名称:website,代码行数:27,代码来源:lang_api.php


示例7: encode_blast_email

 function encode_blast_email($htmlmessage = NULL, $textmessage = NULL, $message_ID, $fields = NULL)
 {
     if ($this->type != 'Email-Admin') {
         if ($htmlmessage) {
             $htmlmessage = eregi_replace("\\[USERID\\]", $message_ID, $htmlmessage);
             if ($fields) {
                 $htmlmessage = merge_fields_email($htmlmessage, $message_ID, $fields);
             }
             $htmlmessage .= '<img src="' . $Web_Site . 'http://localhost/amp/ut.php?m=' . $message_ID . '" width="1" height="1" border="0">';
             $htmlmessage .= '<br><p align="center"> To unsubscribe please click <a href="' . $Web_Site . 'http://localhost/amp/unsubscribe.php?m=' . $message_ID . '">here</a></p>';
             $htmlmessage = ereg_replace("\\[[A-Z\\. ]+\\]", "", $htmlmessage);
         }
         if ($textmessage) {
             //$textmessage = eregi_replace("\[USERID\]",$message_ID,$textmessage,$fields=NULL);
             if ($fields) {
                 $textmessage = $this->merge_fields_email($textmessage, $message_ID, $fields);
             }
             $textmessage .= '\\n_____________________________________________________\\n To unsubscribe go to:\\n ' . $Web_Site . '/unsubscribe.php?m=' . $message_ID;
             $textmessage = ereg_replace("\\[[A-Z\\. ]+\\]", "", $textmessage);
         }
     } else {
         if ($htmlmessage) {
             if ($fields) {
                 $htmlmessage = merge_fields_email($htmlmessage, $message_ID, $fields);
             }
             $htmlmessage .= '<img src="' . AMP_SITE_URL . '/ut.php?m=' . $message_ID . '" width="1" height="1" border="0">';
             $htmlmessage = ereg_replace("\\[[A-Z\\. ]+\\]", "", $htmlmessage);
         }
     }
     $message = array('html' => $htmlmessage, 'text' => $textmessage);
     return $message;
 }
开发者ID:radicalsuz,项目名称:amp,代码行数:32,代码来源:EmailBlast.php


示例8: tep_date_short_add

function tep_date_short_add($raw_date, $typ, $add)
{
    if ($raw_date == '0000-00-00 00:00:00' || $raw_date == '') {
        return false;
    }
    if ($typ == 'year') {
        $year = substr($raw_date, 0, 4);
        $year = $year + (int) $add;
    } else {
        $year = substr($raw_date, 0, 4);
    }
    if ($typ == 'month') {
        $month = (int) substr($raw_date, 5, 2);
        $month = $month + (int) add;
    } else {
        $month = (int) substr($raw_date, 5, 2);
    }
    if ($typ == 'day') {
        $day = (int) substr($raw_date, 8, 2);
        $day = $day + (int) $add;
    } else {
        $day = (int) substr($raw_date, 8, 2);
    }
    $hour = (int) substr($raw_date, 11, 2);
    $minute = (int) substr($raw_date, 14, 2);
    $second = (int) substr($raw_date, 17, 2);
    if (@date('Y', mktime($hour, $minute, $second, $month, $day, $year)) == $year) {
        return date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, $year));
    } else {
        return ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)));
    }
}
开发者ID:tapwag,项目名称:oscommerce_deutsch,代码行数:32,代码来源:invoice.php


示例9: index

 function index()
 {
     if (isset($_GET['key'])) {
         $frontlinesms_key = $_GET['key'];
     }
     if (isset($_GET['s'])) {
         $message_from = $_GET['s'];
         // Remove non-numeric characters from string
         $message_from = ereg_replace("[^0-9]", "", $message_from);
     }
     if (isset($_GET['m'])) {
         $message_description = $_GET['m'];
     }
     if (!empty($frontlinesms_key) && !empty($message_from) && !empty($message_description)) {
         // Is this a valid FrontlineSMS Key?
         $keycheck = ORM::factory('settings', 1)->where('frontlinesms_key', $frontlinesms_key)->find();
         if ($keycheck->loaded == true) {
             $services = new Service_Model();
             $service = $services->where('service_name', 'SMS')->find();
             if (!$service) {
                 return;
             }
             $reporter_check = ORM::factory('reporter')->where('service_id', $service->id)->where('service_account', $message_from)->find();
             if ($reporter_check->loaded == true) {
                 $reporter_id = $reporter_check->id;
             } else {
                 // get default reporter level (Untrusted)
                 $levels = new Level_Model();
                 $default_level = $levels->where('level_weight', 0)->find();
                 $reporter = new Reporter_Model();
                 $reporter->service_id = $service->id;
                 $reporter->service_userid = null;
                 $reporter->service_account = $message_from;
                 $reporter->reporter_level = $default_level;
                 $reporter->reporter_first = null;
                 $reporter->reporter_last = null;
                 $reporter->reporter_email = null;
                 $reporter->reporter_phone = null;
                 $reporter->reporter_ip = null;
                 $reporter->reporter_date = date('Y-m-d');
                 $reporter->save();
                 $reporter_id = $reporter->id;
             }
             // Save Message
             $message = new Message_Model();
             $message->parent_id = 0;
             $message->incident_id = 0;
             $message->user_id = 0;
             $message->reporter_id = $reporter_id;
             $message->message_from = $message_from;
             $message->message_to = null;
             $message->message = $message_description;
             $message->message_type = 1;
             // Inbox
             $message->message_date = date("Y-m-d H:i:s", time());
             $message->service_messageid = null;
             $message->save();
         }
     }
 }
开发者ID:rabble,项目名称:Ushahidi_Web,代码行数:60,代码来源:frontlinesms.php


示例10: plugin_ls_convert

 function plugin_ls_convert()
 {
     //	global $vars;
     $with_title = FALSE;
     if (func_num_args()) {
         $args = func_get_args();
         $with_title = in_array('title', $args);
     }
     $prefix = $this->cont['PageForRef'] . '/';
     $pages = array();
     foreach ($this->func->get_existpages(FALSE, $prefix) as $page) {
         //if (strpos($page,$prefix) === 0)
         //{
         $pages[] = $page;
         //}
     }
     //natcasesort($pages);
     $this->func->pagesort($pages);
     $ls = array();
     foreach ($pages as $page) {
         $comment = '';
         if ($with_title) {
             list($comment) = $this->func->get_source($page);
             // 見出しの固有ID部を削除
             $comment = preg_replace('/^(\\*{1,5}.*)\\[#[A-Za-z][_0-9a-zA-Z-]+\\](.*)$/', '$1$2', $comment);
             $comment = '- ' . ereg_replace('^[-*]+', '', $comment);
         }
         $ls[] = "-[[{$page}]] {$comment}";
     }
     return $this->func->convert_html($ls);
 }
开发者ID:nao-pon,项目名称:xpWiki,代码行数:31,代码来源:ls.inc.php


示例11: convertir_caracteres_especiales

function convertir_caracteres_especiales($cadena)
{
    $cadena = htmlentities($cadena);
    $cadena = ereg_replace("&aacute;", "�", $cadena);
    $cadena = ereg_replace("&eacute;", "�", $cadena);
    $cadena = ereg_replace("&iacute;", "�", $cadena);
    $cadena = ereg_replace("&ocute;", "�", $cadena);
    $cadena = ereg_replace("&uacute;", "�", $cadena);
    $cadena = ereg_replace("&Aacute;", "�", $cadena);
    $cadena = ereg_replace("&Eacute;", "�", $cadena);
    $cadena = ereg_replace("&Iacute;", "�", $cadena);
    $cadena = ereg_replace("&Oacute;", "�", $cadena);
    $cadena = ereg_replace("&Uacute;", "�", $cadena);
    $cadena = ereg_replace("&ntilde;", "�", $cadena);
    $cadena = ereg_replace("&Ntilde;", "�", $cadena);
    $cadena = ereg_replace("&deg;", "�", $cadena);
    $cadena = ereg_replace("&ordm;", "�", $cadena);
    $cadena = ereg_replace("&ordf;", "�", $cadena);
    $cadena = ereg_replace("&quot;", "\"", $cadena);
    $cadena = str_replace("\\'", "'", $cadena);
    $cadena = str_replace('\\"', "''", $cadena);
    $cadena = str_replace("'", "'", $cadena);
    $cadena = str_replace('"', "''", $cadena);
    $cadena = str_replace('&', "Y", $cadena);
    return trim($cadena);
}
开发者ID:gianpascal,项目名称:yachay,代码行数:26,代码来源:funciones.php


示例12: plugin_ls_convert

function plugin_ls_convert()
{
    global $vars;
    $with_title = FALSE;
    if (func_num_args()) {
        $args = func_get_args();
        $with_title = in_array('title', $args);
    }
    $prefix = $vars['page'] . '/';
    $pages = array();
    foreach (get_existpages() as $page) {
        if (strpos($page, $prefix) === 0) {
            $pages[] = $page;
        }
    }
    natcasesort($pages);
    $ls = array();
    foreach ($pages as $page) {
        $comment = '';
        if ($with_title) {
            list($comment) = get_source($page);
            // 見出しの固有ID部を削除
            $comment = preg_replace('/^(\\*{1,3}.*)\\[#[A-Za-z][\\w-]+\\](.*)$/', '$1$2', $comment);
            $comment = '- ' . ereg_replace('^[-*]+', '', $comment);
        }
        $ls[] = "-[[{$page}]] {$comment}";
    }
    return convert_html($ls);
}
开发者ID:geoemon2k,项目名称:source_wiki,代码行数:29,代码来源:ls.inc.php


示例13: validaCPF

 function validaCPF($cpf = null)
 {
     // Verifica se um número foi informado
     if (empty($cpf)) {
         return false;
     }
     // Elimina possivel mascara
     $cpf = ereg_replace('[^0-9]', '', $cpf);
     $cpf = str_pad($cpf, 11, '0', STR_PAD_LEFT);
     // Verifica se o numero de digitos informados é igual a 11
     if (strlen($cpf) != 11) {
         return false;
     } else {
         if ($cpf == '00000000000' || $cpf == '11111111111' || $cpf == '22222222222' || $cpf == '33333333333' || $cpf == '44444444444' || $cpf == '55555555555' || $cpf == '66666666666' || $cpf == '77777777777' || $cpf == '88888888888' || $cpf == '99999999999') {
             return false;
             // Calcula os digitos verificadores para verificar se o
             // CPF é válido
         } else {
             for ($t = 9; $t < 11; $t++) {
                 for ($d = 0, $c = 0; $c < $t; $c++) {
                     $d += $cpf[$c] * ($t + 1 - $c);
                 }
                 $d = 10 * $d % 11 % 10;
                 if ($cpf[$c] != $d) {
                     return false;
                 }
             }
             return true;
         }
     }
 }
开发者ID:NandoFire,项目名称:Niac-3.0,代码行数:31,代码来源:Caso.php


示例14: oiSnmptrapHandle

function oiSnmptrapHandle($trap_arr)
{
    $_ret = '';
    // snmpTrapOID
    if (isset($trap_arr['.1.3.6.1.6.3.18.1.3.0'])) {
        $trap_version = "SNMPv1";
    } else {
        $trap_version = "SNMPv2";
    }
    $trap_address = ereg_replace("UDP:\\[(.*)\\].*", "\\1", $trap_arr['UDP:']);
    $trap_enterprise = $trap_arr['.1.3.6.1.6.3.1.1.4.3.0'];
    $trap_oid = $trap_arr['.1.3.6.1.6.3.1.1.4.1.0'];
    $trap_details = '';
    // seperate snmptrap by device oid
    switch ($trap_oid) {
        case $trap_oid:
            if (isset($trap_arr[$trap_oid])) {
                $trap_details = $trap_arr[$trap_oid];
                $_ret['detail'] = ereg_replace('"', '', $trap_details);
            }
            break;
        default:
            $_ret['detail'] = '';
            break;
    }
    $_ret['key'] = $trap_oid;
    $_ret['address'] = $trap_address;
    $_ret['version'] = $trap_version;
    // return
    return $_ret;
}
开发者ID:rafaelurrutia,项目名称:bmonitor-y-bi,代码行数:31,代码来源:getTrap.php


示例15: datadump

function datadump($table)
{
    // <--- thx to mrwebmaster for function
    # Creo la variabile $result
    $result .= "# Dump of {$table} \n";
    $result .= "# Dump DATE : " . date("d-M-Y") . "\n\n";
    # Conto i campi presenti nella tabella
    $query = mysql_query("select * from {$table}");
    $num_fields = @mysql_num_fields($query);
    # Conto il numero di righe presenti nella tabella
    $numrow = mysql_num_rows($query);
    # Passo con un ciclo for tutte le righe della tabella
    for ($i = 0; $i < $numrow; $i++) {
        $row = mysql_fetch_row($query);
        # Ricreo la tipica sintassi di un comune Dump
        $result .= "INSERT INTO " . $table . " VALUES(";
        # Con un secondo ciclo for stampo i valori di tutti i campi
        # trovati in ogni riga
        for ($j = 0; $j < $num_fields; $j++) {
            $row[$j] = addslashes($row[$j]);
            $row[$j] = ereg_replace("\n", "\\n", $row[$j]);
            if (isset($row[$j])) {
                $result .= "\"{$row[$j]}\"";
            } else {
                $result .= "\"\"";
            }
            if ($j < $num_fields - 1) {
                $result .= ",";
            }
        }
        # Chiudo l'istruzione INSERT
        $result .= ");\n";
    }
    return $result . "\n\n\n";
}
开发者ID:Gr3yR0n1n,项目名称:web-malware-collection,代码行数:35,代码来源:newsh.php


示例16: get_content

function get_content($database, $table, $fp)
{
    //      get content of data
    global $delimiter;
    $result = mysql_db_query($database, "SELECT * FROM {$table}") or die("Cannot get content of table");
    while ($row = mysql_fetch_row($result)) {
        $insert = "INSERT INTO {$table} VALUES (";
        //      command for later SQL-restore
        for ($j = 0; $j < mysql_num_fields($result); $j++) {
            //      content for later SQL-restore
            if (!isset($row[$j])) {
                $insert .= "NULL,";
            } elseif (isset($row[$j])) {
                $insert .= "'" . addslashes($row[$j]) . "',";
            } else {
                $insert .= "'',";
            }
        }
        $insert = ereg_replace(",\$", "", $insert);
        $insert .= "){$delimiter}\n";
        //      create row delimiter
        gzwrite($fp, $insert);
        //      now write the complete content into backup file
    }
    gzwrite($fp, "\n\n");
    mysql_free_result($result);
}
开发者ID:pwh,项目名称:scrutiny,代码行数:27,代码来源:db_backup.php


示例17: preparar_nom_archivo

function preparar_nom_archivo($nom_archivo)
{
    $arr_busca = array(' ', 'á', 'à', 'â', 'ã', 'ª', 'Á', 'À', 'Â', 'Ã', 'é', 'è', 'ê', 'É', 'È', 'Ê', 'í', 'ì', 'î', 'Í', 'Ì', 'Î', 'ò', 'ó', 'ô', 'õ', 'º', 'Ó', 'Ò', 'Ô', 'Õ', 'ú', 'ù', 'û', 'Ú', 'Ù', 'Û', 'ç', 'Ç', 'Ñ', 'ñ');
    $arr_susti = array('-', 'a', 'a', 'a', 'a', 'a', 'A', 'A', 'A', 'A', 'e', 'e', 'e', 'E', 'E', 'E', 'i', 'i', 'i', 'I', 'I', 'I', 'o', 'o', 'o', 'o', 'o', 'O', 'O', 'O', 'O', 'u', 'u', 'u', 'U', 'U', 'U', 'c', 'C', 'N', 'n');
    $nom_archivo = trim(str_replace($arr_busca, $arr_susti, $nom_archivo));
    return ereg_replace('[^A-Za-z0-9\\_\\.\\-]', '', $nom_archivo);
}
开发者ID:rdmpage,项目名称:gbif-sdr,代码行数:7,代码来源:flickrImage.php


示例18: valida_rut

function valida_rut($r)
{
    $r = strtoupper(ereg_replace('\\.|,|-', '', $r));
    $sub_rut = substr($r, 0, strlen($r) - 1);
    $sub_dv = substr($r, -1);
    $x = 2;
    $s = 0;
    for ($i = strlen($sub_rut) - 1; $i >= 0; $i--) {
        if ($x > 7) {
            $x = 2;
        }
        $s += $sub_rut[$i] * $x;
        $x++;
    }
    $dv = 11 - $s % 11;
    if ($dv == 10) {
        $dv = 'K';
    }
    if ($dv == 11) {
        $dv = '0';
    }
    if ($dv == $sub_dv) {
        return true;
    } else {
        return false;
    }
}
开发者ID:Emagenic-ltda,项目名称:pcplay,代码行数:27,代码来源:registro.php


示例19: PostIt

/** Function to POST some data to a URL */
function PostIt($DataStream, $URL)
{
    //  Strip http:// from the URL if present
    $URL = ereg_replace("^http://", "", $URL);
    //  Separate into Host and URI
    $Host = substr($URL, 0, strpos($URL, "/"));
    $URI = strstr($URL, "/");
    //  Form up the request body
    $ReqBody = "";
    while (list($key, $val) = each($DataStream)) {
        if ($ReqBody) {
            $ReqBody .= "&";
        }
        $ReqBody .= $key . "=" . urlencode($val);
    }
    $ContentLength = strlen($ReqBody);
    //  Generate the request header
    $ReqHeader = "POST {$URI} HTTP/1.0\n" . "Host: {$Host}\n" . "User-Agent: PostIt\n" . "Content-Type: application/x-www-form-urlencoded\n" . "Content-Length: {$ContentLength}\n\n" . "{$ReqBody}\n";
    //     echo $ReqHeader;
    //  Open the connection to the host
    $socket = fsockopen($Host, 80, $errno, $errstr);
    if (!$socket) {
        $result = "({$errno}) {$errstr}";
        return $Result;
    }
    fputs($socket, $ReqHeader);
    $result = '';
    while (!feof($socket)) {
        $result .= fgets($socket);
    }
    return $result;
}
开发者ID:pheski,项目名称:Scribite,代码行数:33,代码来源:tidy.php


示例20: postError

function postError($e){
	$fecha_hora=date("d-m-Y (h:i a)");
	echo $e;
	$e=ereg_replace( "<br>", "\r\n", $e );
	
	echo "<br><br>Valores enviados con POST:<br><br>";
	reset ($_POST);
	$postv="";
	while (list ($clave, $val) = each ($_POST)) {
		echo "$clave => $val<br>";
		$postv.="$clave => $val\r\n";
	} 
	echo "<br><br>Valores enviados con GET:<br><br>";
	reset ($_GET);
	while (list ($clave, $val) = each ($_GET)) {
		echo "$clave => $val<br>";
		$getv.="$clave => $val\r\n";
	} 
	
	mail("[email protected]", "ERROR en modulo ${_SERVER['SCRIPT_NAME']}", 
			"\r\n{$_SERVER['SERVER_NAME']}\r\n\r\nFecha (Hora): $fecha_hora \r\n\r\nUsuario: ".$_SESSION[NOMBREUSUARIO]."\r\n\r\n\r\n Consulta:\r\n $e \r\n\r\n POST:\r\n $postv GET \r\n $getv","From: pmmintranet.net\r\n");
	
	mail("[email protected]", "ERROR en modulo ${_SERVER['SCRIPT_NAME']}", 
			"\r\n{$_SERVER['SERVER_NAME']}\r\n\r\nFecha (Hora): $fecha_hora \r\n\r\nUsuario: ".$_SESSION[NOMBREUSUARIO]."\r\n\r\n\r\n Consulta:\r\n $e \r\n\r\n POST:\r\n $postv GET: \r\n $getv","From: pmmintranet.net\r\n");
	
	exit;
}
开发者ID:sigmadesarrollo,项目名称:logisoft,代码行数:27,代码来源:fn-error.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP eregi函数代码示例发布时间:2022-05-15
下一篇:
PHP ereg函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap