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


PHP utf8_encode函数代码示例

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


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

示例1: do_request

 /**
  * Do CURL request with authorization
  */
 private function do_request($resource, $method, $input)
 {
     $called_url = $this->base_url . "/" . $resource;
     $ch = curl_init($called_url);
     $c_date_time = date("r");
     $md5_content = "";
     if ($input != "") {
         $md5_content = md5($input);
     }
     $content_type = "application/json";
     $sign_string = $method . "\n" . $md5_content . "\n" . $content_type . "\n" . $c_date_time . "\n" . $called_url;
     $time_header = 'X-mailin-date:' . $c_date_time;
     $auth_header = 'Authorization:' . $this->access_key . ":" . base64_encode(hash_hmac('sha1', utf8_encode($sign_string), $this->secret_key));
     $content_header = "Content-Type:application/json";
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         // Windows only over-ride
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     }
     curl_setopt($ch, CURLOPT_HTTPHEADER, array($time_header, $auth_header, $content_header));
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $input);
     $data = curl_exec($ch);
     if (curl_errno($ch)) {
         echo 'Curl error: ' . curl_error($ch) . '\\n';
     }
     curl_close($ch);
     return json_decode($data, true);
 }
开发者ID:lokeshguptasldt,项目名称:mailin-api-php,代码行数:34,代码来源:mailin.php

示例2: save_xml_file

function save_xml_file($filename, $xml_file)
{
    global $app_strings;
    $handle = fopen($filename, 'w');
    //fwrite($handle,iconv("GBK","UTF-8",$xml_file));
    if (!$handle) {
        return;
    }
    // Write $somecontent to our opened file.)
    if ($app_strings['LBL_CHARSET'] == "GBK") {
        if (function_exists('iconv')) {
            $xml_file = iconv_ec("GB2312", "UTF-8", $xml_file);
        } else {
            $chs = new Chinese("GBK", "UTF8", trim($xml_file));
            $xml_file = $chs->ConvertIT();
        }
        if (fwrite($handle, $xml_file) === FALSE) {
            return false;
        }
    } else {
        if ($app_strings['LBL_CHARSET'] != "UTF-8") {
            //$xml_file = iconv("ISO-8859-1","UTF-8",$xml_file);
            if (fwrite($handle, utf8_encode($xml_file)) === FALSE) {
                return false;
            }
        } else {
            if (fwrite($handle, $xml_file) === FALSE) {
                return false;
            }
        }
    }
    fclose($handle);
    return true;
}
开发者ID:honj51,项目名称:taobaocrm,代码行数:34,代码来源:Charts.php

示例3: ListField

function ListField($field)
{
    if ($field !== null && $field !== '' && $field !== 'undefined') {
        $fieldtrue = explode('|', $field);
        return utf8_encode($fieldtrue[1]);
    }
}
开发者ID:neruruguay,项目名称:neru,代码行数:7,代码来源:Properties.php

示例4: server

function server()
{
    list($dr, $nod) = split_right('/', $_GET['table'], 1);
    $main = msql_read($dr, $nod, '');
    //p($main);
    if ($main) {
        $dscrp = flux_xml($main);
    }
    $host = $_SERVER['HTTP_HOST'];
    //$dscrp=str_replace('users/','http://'.$host.'/users/',$dscrp);
    //$dscrp=str_replace('img/','http://'.$host.'/img/',$dscrp);
    $xml = '<' . '?xml version="1.0" encoding="utf-8" ?' . '>' . "\n";
    //iso-8859-1//
    $xml .= '<rss version="2.0">' . "\n";
    $xml .= '<channel>' . "\n";
    $xml .= '<title>http://' . $host . '/msql/' . $_GET['table'] . '</title>' . "\n";
    $xml .= '<link>http://' . $host . '/</link>' . "\n";
    $xml .= '<description>' . count($main) . ' entries</description>' . "\n";
    $xml .= $dscrp;
    $xml .= '</channel>' . "\n";
    $xml .= '</rss>' . "\n";
    //$xml.='</xml>'."\n";
    if ($_GET['bz2']) {
        return bzcompress($xml);
    }
    if ($_GET["b64"]) {
        return base64_encode($xml);
    }
    return utf8_encode($xml);
}
开发者ID:philum,项目名称:cms,代码行数:30,代码来源:microxml.php

示例5: isoConvert

 /**
  * Converts ISO-8859-1 strings to UTF-8 if necessary.
  *
  * @param string $string text which is to check
  * @return string with utf-8 encoding
  */
 public function isoConvert($string)
 {
     if (!preg_match('/\\S/u', $string)) {
         $string = utf8_encode($string);
     }
     return $string;
 }
开发者ID:alexschwarz89,项目名称:Barzahlen-OXID-4.7,代码行数:13,代码来源:base.php

示例6: convertToPHPValue

 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if ($value !== null) {
         $value = utf8_encode($value);
     }
     return parent::convertToPHPValue($value, $platform);
 }
开发者ID:improvein,项目名称:MssqlBundle,代码行数:7,代码来源:TextType.php

示例7: set_user_config

 public function set_user_config($username, $password, $fields)
 {
     $req = array();
     $req['auth']['rw'] = 1;
     // request read-write mode
     $req['user']['username'] = utf8_encode($username);
     $req['user']['password'] = utf8_encode($password);
     // modify values in place
     foreach ($fields as &$value) {
         $value = utf8_encode($value);
     }
     $req['mailbox']['update'][$username] = $fields;
     $arr = $this->get_url($this->build_url($req));
     $res = $this->decrypt($arr[0]);
     if (empty($res)) {
         return array(FALSE, 'Decode error');
     }
     if ($this->debug) {
         $debug_str = '';
         $debug_str .= print_r($req, TRUE);
         $debug_str .= print_r($arr, TRUE);
         $debug_str .= print_r($res, TRUE);
         write_log('vboxadm', $debug_str);
     }
     if ($res['action'] == 'ok') {
         return array(TRUE, $res['mailbox']['update'][$username]['msgs']);
     } else {
         return array(FALSE, $res['error']['str']);
     }
 }
开发者ID:jonathan00,项目名称:roundcube-plugin-vboxadm,代码行数:30,代码来源:vboxapi.php

示例8: mensagensRecebidas

    public function mensagensRecebidas($destinatario)
    {
        $mensagemController = new MensagemController();
        $usuarioController = new UsuarioController();
        $mensagem = $mensagemController->listaRecebidos($destinatario);
        if (count($mensagem) > 0) {
            foreach ($mensagem as $value) {
                if ($value->getMsg_lida() === 'n') {
                    $naolida = 'msg_nao_lida';
                } else {
                    $naolida = '';
                }
                $usuario = $usuarioController->select($value->getMsg_remetente());
                echo '<div id="msg_valores_' . $value->getMsg_id() . '" class="recebido ' . $naolida . ' col1 row msg_valores_' . $value->getMsg_id() . '" style="cursor: pointer">
					  <p class="msg_check col-md-1"><span class="check-box" id="' . $value->getMsg_id() . '"></span></p>
					  <div  onclick="RecebidasDetalheFuncao(' . utf8_encode($value->getMsg_id()) . ')">
						<p class="msg_nome col-md-2">' . utf8_encode($usuario->getUsr_nome()) . '</p>
						<p class="msg_assunto col-md-7">' . utf8_encode($value->getMsg_assunto()) . '</p>
						<p class="msg_data col-md-2">' . date('d/m/Y', strtotime($value->getMsg_data())) . '</p>
					</div>
				</div>';
            }
        } else {
            echo '<div class="alert alert-warning" role="alert"><strong>Nenhuma mensagem em sua Caixa de Entrada.</strong></div>';
        }
    }
开发者ID:amorimlima,项目名称:Hospital,代码行数:26,代码来源:TemplateMensagens.php

示例9: objectToArray

 /**
  * Converter objetos em array.
  * 
  * @param type $var
  * @return type
  */
 public static function objectToArray($var)
 {
     $result = array();
     $references = array();
     // loop over elements/properties
     foreach ($var as $key => $value) {
         // recursively convert objects
         if (is_object($value) || is_array($value)) {
             // but prevent cycles
             if (!in_array($value, $references)) {
                 // Verificar se o valor é nulo. Não adiciona tuplas
                 // vazias ao json
                 if (!is_null($value) && !empty($value)) {
                     $result[$key] = JsonUtil::objectToArray($value);
                     $references[] = $value;
                 }
             }
         } else {
             // Verificar se o valor é nulo. Não adiciona tuplas
             // vazias ao json
             if (!is_null($value) && !empty($value)) {
                 // simple values are untouched
                 $result[$key] = utf8_encode($value);
             }
         }
     }
     return $result;
 }
开发者ID:joseilsonjunior,项目名称:nutrif,代码行数:34,代码来源:JsonUtil.php

示例10: encrypt

function encrypt($pure_string, $encryption_key)
{
    $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
    $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
    $encrypted_string = mcrypt_encrypt(MCRYPT_BLOWFISH, $encryption_key, utf8_encode($pure_string), MCRYPT_MODE_ECB, $iv);
    return base64_encode($encrypted_string);
}
开发者ID:robotys,项目名称:sacl,代码行数:7,代码来源:rbt_helper.php

示例11: ote_accent

function ote_accent($str)
{
    $str = str_replace("'", " ", $str);
    $str = utf8_decode($str);
    $ch = strtr($str, '����������������������������������������������������', 'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
    return utf8_encode($ch);
}
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:7,代码来源:page_iso.php

示例12: url

 public function url($reference)
 {
     $timestamp = gmdate('D, d M Y H:i:s T');
     $security = base64_encode(hash_hmac('sha256', utf8_encode("{$reference}\n{$timestamp}"), $this->client->api_secret, true));
     $data = array('key' => $this->client->api_key, 'timestamp' => $timestamp, 'reference' => $reference, 'security' => $security);
     return $this->client->api_endpoint . '/widget?' . http_build_query($data);
 }
开发者ID:Wizypay,项目名称:wizypay-api-client-php,代码行数:7,代码来源:card.php

示例13: sms

 public function sms()
 {
     $funcionalidades = new funcionalidades();
     $conn = new conn();
     $conn->insert(array('dtCad' => $this->data, 'campanha' => utf8_encode($this->nome), 'palavra_chave' => $this->palavras_chaves, 'descricao' => $this->descricao, 'validadeIni' => $funcionalidades->ChecaVariavel($this->valiadeDe, "data"), 'validadeFim' => $funcionalidades->ChecaVariavel($this->validadeAte, "data"), 'patrocinador' => $this->patrocinador, 'qtdCupons' => $this->qtd, 'contato' => $this->contato, 'mensagem' => $funcionalidades->removeAcentos($this->msg), 'dt_limiteCupom' => $funcionalidades->ChecaVariavel($this->dt_limiteCupom, "data"), 'mensagem_encerrado' => $funcionalidades->removeAcentos($this->mensagem_encerrado), 'status' => 1), "", "campanha_sms");
     exit("<script>alert('Campanha cadastrada com sucesso!');document.location.href='painel-index.php';</script>");
 }
开发者ID:THAYLLER,项目名称:api_sms,代码行数:7,代码来源:sms.php

示例14: __construct

 /**
  * Construct calendar response
  *
  * @param Calendar $calendar Calendar
  * @param int      $status   Response status
  * @param array    $headers  Response headers
  */
 public function __construct(Calendar $calendar, $status = 200, $headers = array())
 {
     $this->calendar = $calendar;
     $content = utf8_encode($calendar->createCalendar());
     $headers = array_merge($this->getDefaultHeaders(), $headers);
     parent::__construct($content, $status, $headers);
 }
开发者ID:dyvelop,项目名称:icalcreator-bundle,代码行数:14,代码来源:CalendarResponse.php

示例15: parseCSV

 /**
  * Parse a csv file
  * 
  * @return array
  */
 public function parseCSV()
 {
     $finder = new Finder();
     $rows = array();
     $convert_utf8 = function ($s) {
         if (!mb_check_encoding($s, 'UTF-8')) {
             $s = utf8_encode($s);
         }
         return $s;
     };
     $finder->files()->in($this->path)->name($this->fileName);
     foreach ($finder as $file) {
         $csv = $file;
     }
     if (($handle = fopen($csv->getRealPath(), "r")) !== false) {
         $i = 0;
         while (($data = fgetcsv($handle, null, ";")) !== false) {
             $i++;
             if ($this->ignoreFirstLine && $i == 1) {
                 continue;
             }
             $rows[] = array_map($convert_utf8, $data);
         }
         fclose($handle);
     }
     return $rows;
 }
开发者ID:Bobarisoa,项目名称:noucoz-release,代码行数:32,代码来源:Csv.php


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