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

PHP utf8_decode函数代码示例

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

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



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

示例1: addptext

 private function addptext($styleconf, $text, $posx = null, $posy = null, $width = 0, $height = 0)
 {
     static $cfonts = array();
     $font = $this->conf[$styleconf . '_font'];
     $size = isset($this->conf[$styleconf . '_size']) ? $this->conf[$styleconf . '_size'] : 10;
     $style = isset($this->conf[$styleconf . '_style']) ? $this->conf[$styleconf . '_style'] : '';
     $color = isset($this->conf[$styleconf . '_color']) ? $this->conf[$styleconf . '_color'] : '#000000';
     $height = isset($this->conf[$styleconf . '_height']) ? $this->conf[$styleconf . '_height'] : $height;
     $text = utf8_decode($text);
     if (!is_file(FPDF_FONTPATH . $font . '.php')) {
         ob_start();
         MakeFont(FPDF_FONTPATH . $font . '.ttf');
         file_put_contents(FPDF_FONTPATH . $font . '.log', ob_get_contents());
         ob_end_clean();
     }
     if (!isset($cfonts[$font])) {
         $cfonts[$font] = $this->AddFont($font, $style, $font . '.php');
     }
     $this->SetFont($font, $style, $size);
     $this->colordecode($color, $comp);
     $this->SetTextColor($comp[0], $comp[1], $comp[2]);
     if ($posx !== null && $posy !== null) {
         $this->SetXY($posx, $posy);
         $this->Cell($width, $height, $text, $this->border);
     } else {
         $this->Write($height, $text);
     }
 }
开发者ID:bontiv,项目名称:intrateb,代码行数:28,代码来源:genserie.php


示例2: generatePDF

 function generatePDF()
 {
     // tempfolder
     $tmpBaseFolder = TEMP_FOLDER . '/shopsystem';
     $tmpFolder = project() ? "{$tmpBaseFolder}/" . project() : "{$tmpBaseFolder}/site";
     if (is_dir($tmpFolder)) {
         Filesystem::removeFolder($tmpFolder);
     }
     if (!file_exists($tmpFolder)) {
         Filesystem::makeFolder($tmpFolder);
     }
     $baseFolderName = basename($tmpFolder);
     //Get site
     Requirements::clear();
     $link = Director::absoluteURL($this->pdfLink() . "/?view=1");
     $response = Director::test($link);
     $content = $response->getBody();
     $content = utf8_decode($content);
     $contentfile = "{$tmpFolder}/" . $this->PublicURL . ".html";
     if (!file_exists($contentfile)) {
         // Write to file
         if ($fh = fopen($contentfile, 'w')) {
             fwrite($fh, $content);
             fclose($fh);
         }
     }
     return $contentfile;
 }
开发者ID:pstaender,项目名称:ShopSystem,代码行数:28,代码来源:ShopInvoice.php


示例3: call

 public function call($data)
 {
     $default_parameters = array('USER' => $this->config->get('pp_payflow_iframe_user'), 'VENDOR' => $this->config->get('pp_payflow_iframe_vendor'), 'PWD' => $this->config->get('pp_payflow_iframe_password'), 'PARTNER' => $this->config->get('pp_payflow_iframe_partner'), 'BUTTONSOURCE' => 'OpenCart_Cart_PFP');
     $call_parameters = array_merge($data, $default_parameters);
     if ($this->config->get('pp_payflow_iframe_test')) {
         $url = 'https://pilot-payflowpro.paypal.com';
     } else {
         $url = 'https://payflowpro.paypal.com';
     }
     $query_params = array();
     foreach ($call_parameters as $key => $value) {
         $query_params[] = $key . '=' . utf8_decode($value);
     }
     $this->log('Call data: ' . implode('&', $query_params));
     $curl = curl_init($url);
     curl_setopt($curl, CURLOPT_POST, true);
     curl_setopt($curl, CURLOPT_POSTFIELDS, implode('&', $query_params));
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($curl, CURLOPT_HEADER, false);
     curl_setopt($curl, CURLOPT_TIMEOUT, 30);
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
     $response = curl_exec($curl);
     $this->log('Response data: ' . $response);
     $response_params = array();
     parse_str($response, $response_params);
     return $response_params;
 }
开发者ID:ahmatjan,项目名称:OpenCart-Overclocked,代码行数:27,代码来源:pp_payflow_iframe.php


示例4: parse

 /**
  * @param string xml content
  * @return true|PEAR_Error
  */
 function parse($data)
 {
     if (!extension_loaded('xml')) {
         include_once 'PEAR.php';
         return PEAR::raiseError("XML Extension not found", 1);
     }
     $this->_dataStack = $this->_valStack = array();
     $this->_depth = 0;
     if (strpos($data, 'encoding="UTF-8"') || strpos($data, 'encoding="utf-8"') || strpos($data, "encoding='UTF-8'") || strpos($data, "encoding='utf-8'")) {
         $this->encoding = 'UTF-8';
     }
     if (version_compare(phpversion(), '5.0.0', 'lt') && $this->encoding == 'UTF-8') {
         $data = utf8_decode($data);
         $this->encoding = 'ISO-8859-1';
     }
     $xp = xml_parser_create($this->encoding);
     xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, 0);
     xml_set_object($xp, $this);
     xml_set_element_handler($xp, 'startHandler', 'endHandler');
     xml_set_character_data_handler($xp, 'cdataHandler');
     if (!xml_parse($xp, $data)) {
         $msg = xml_error_string(xml_get_error_code($xp));
         $line = xml_get_current_line_number($xp);
         xml_parser_free($xp);
         include_once 'PEAR.php';
         return PEAR::raiseError("XML Error: '{$msg}' on line '{$line}'", 2);
     }
     xml_parser_free($xp);
     return true;
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:34,代码来源:XMLParser.php


示例5: button

 /**
  * Erzeugt Button
  * @param string $type
  * @param string $name
  * @param string $descr
  * @param string $class
  */
 public static function button($type, $name, $descr, $class = '', $isNotUtf8 = false)
 {
     if ($isNotUtf8) {
         $descr = utf8_decode($descr);
     }
     print "<button type=\"{$type}\" class=\"buttons {$class}\" name=\"{$name}\" id=\"{$name}\">{$descr}</button>";
 }
开发者ID:sea75300,项目名称:affiliat_r,代码行数:14,代码来源:viewHelper.php


示例6: Footer

 function Footer()
 {
     $this->SetY(-15);
     $this->SetFont('Arial', '', 8);
     $this->SetTextColor(128);
     $this->Cell(0, 10, utf8_decode('Centro Paraibano de Quiropraxia'), 0, 0, 'C');
 }
开发者ID:saulor,项目名称:cpbquirophp,代码行数:7,代码来源:AgendaDiaria.php


示例7: getForm

 /**
  * Method to get the record form.
  *
  * @param   array    $data      An optional array of data for the form to interogate.
  * @param   boolean  $loadData  True if the form is to load its own data (default case), false if not.
  *
  * @return  JForm    A JForm object on success, false on failure
  *
  * @since   1.6
  */
 public function getForm($data = array(), $loadData = true)
 {
     // Get the form.
     $form = $this->loadForm('com_admin.profile', 'profile', array('control' => 'jform', 'load_data' => $loadData));
     if (empty($form)) {
         return false;
     }
     // Check for username compliance and parameter set
     $isUsernameCompliant = true;
     if ($this->loadFormData()->username) {
         $username = $this->loadFormData()->username;
         $isUsernameCompliant = !(preg_match('#[<>"\'%;()&\\\\]|\\.\\./#', $username) || strlen(utf8_decode($username)) < 2 || trim($username) != $username);
     }
     $this->setState('user.username.compliant', $isUsernameCompliant);
     if (!JComponentHelper::getParams('com_users')->get('change_login_name') && $isUsernameCompliant) {
         $form->setFieldAttribute('username', 'required', 'false');
         $form->setFieldAttribute('username', 'readonly', 'true');
         $form->setFieldAttribute('username', 'description', 'COM_ADMIN_USER_FIELD_NOCHANGE_USERNAME_DESC');
     }
     // When multilanguage is set, a user's default site language should also be a Content Language
     if (JLanguageMultilang::isEnabled()) {
         $form->setFieldAttribute('language', 'type', 'frontend_language', 'params');
     }
     // If the user needs to change their password, mark the password fields as required
     if (JFactory::getUser()->requireReset) {
         $form->setFieldAttribute('password', 'required', 'true');
         $form->setFieldAttribute('password2', 'required', 'true');
     }
     return $form;
 }
开发者ID:Jovaage,项目名称:joomla-cms,代码行数:40,代码来源:profile.php


示例8: validar_direccion

 function validar_direccion($direccion)
 {
     //Nos conectamnos a la Api de ggogle maps para validar la dirección. Si es válida, obtendremos las coordenadas y
     // podremos mostrar el punto de venta en un mapa.
     $base_url = "https://maps.googleapis.com/maps/api/geocode/json?";
     $idcomuna = $this->input->post('IdComuna');
     $idregion = $this->input->post('IdRegion');
     $idprovincia = $this->input->post('IdProvincia');
     if ($idcomuna != "" && $idregion != "" && $idprovincia != "") {
         $region = $this->common_model->buscar_fila_sql('region', 'IdRegion', $idregion)->Nombre;
         $provincia = $this->common_model->buscar_fila_sql('provincia', 'IdProvincia', $idprovincia)->Nombre;
         $comuna = $this->common_model->buscar_fila_sql('comuna', 'IdComuna', $idcomuna)->Nombre;
         //Buscar coordenadas de la dirección
         $address = utf8_decode($direccion . ',' . $comuna . ',' . $provincia . ', Chile');
         $request_url = $base_url . "address=" . urlencode($address);
         $result = file_get_contents($request_url) or die("url not loading");
         $arr = json_decode($result, true);
         //resultados en un arreglo.
         if ($arr['status'] == "OK") {
             $this->latitud = $arr['results'][0]['geometry']['location']['lat'];
             $this->longitud = $arr['results'][0]['geometry']['location']['lng'];
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:jgarceso,项目名称:convivir,代码行数:29,代码来源:PuntosVenta.php


示例9: fromSong

 /**
  * Generate the downloadable path for a song.
  *
  * @param Song $song
  *
  * @return string
  */
 protected function fromSong(Song $song)
 {
     if ($s3Params = $song->s3_params) {
         // The song is hosted on Amazon S3.
         // We download it back to our local server first.
         $localPath = rtrim(sys_get_temp_dir(), '/') . '/' . basename($s3Params['key']);
         $url = $song->getObjectStoragePublicUrl();
         abort_unless($url, 404);
         // The following function require allow_url_fopen to be ON.
         // We're just assuming that to be the case here.
         copy($url, $localPath);
     } else {
         // The song is hosted locally. Make sure the file exists.
         abort_unless(file_exists($song->path), 404);
         $localPath = $song->path;
     }
     // The BinaryFileResponse factory only accept ASCII-only file names.
     if (ctype_print($localPath)) {
         return $localPath;
     }
     // For those with high-byte characters in names, we copy it into a safe name
     // as a workaround.
     $newPath = rtrim(sys_get_temp_dir(), '/') . '/' . utf8_decode(basename($song->path));
     if ($s3Params) {
         // If the file is downloaded from S3, we rename it directly.
         // This will save us some disk space.
         rename($localPath, $newPath);
     } else {
         // Else we copy it to another file to not mess up the original one.
         copy($localPath, $newPath);
     }
     return $newPath;
 }
开发者ID:phanan,项目名称:koel,代码行数:40,代码来源:Download.php


示例10: processXML

 function processXML($rawXML)
 {
     //echo '<pre>' . $rawXML . '</pre>';
     $rawXML = utf8_decode($rawXML);
     $rawXML = iconv("UTF-8", "UTF-8//IGNORE", $rawXML);
     //echo '<pre>' . $rawXML . '</pre>';
     if (!$this->parse($rawXML)) {
         return false;
     }
     // parse the submitted string, check for errors
     //echo 'parsed string = '; print_r($this->arrOutput); echo '<br />';
     $this->username = $this->getNodeData(array('ACCESSREQUEST', 'ACCESSUSERID'), $this->arrOutput);
     $this->password = $this->getNodeData(array('ACCESSREQUEST', 'ACCESSPASSWORD'), $this->arrOutput);
     if (!$this->validateUser($this->username, $this->password)) {
         return false;
     }
     // verify username and password
     //echo 'user was validated<br />';
     if (!$this->formatArray()) {
         return false;
     }
     // format submitted string into order array, check for errors
     //echo 'array was formatted<br />';
     if (!$this->buildJournalEntry()) {
         return false;
     }
     //echo 'journal entry was built and posted<br />';
     return true;
 }
开发者ID:jigsmaheta,项目名称:puerto-argentino,代码行数:29,代码来源:orders.php


示例11: convertToDatabaseValue

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


示例12: parse_path

function parse_path() {
  $path = array();
  if (isset($_SERVER['REQUEST_URI'])) {
    $request_path = explode('?', $_SERVER['REQUEST_URI']);

    $path['base'] = rtrim(dirname($_SERVER['SCRIPT_NAME']), '\/');
    $path['call_utf8'] = substr(urldecode($request_path[0]), strlen($path['base']) + 1);
    $path['call'] = utf8_decode($path['call_utf8']);
    if ($path['call'] == basename($_SERVER['PHP_SELF'])) {
      $path['call'] = '';
    }
    $path['call_parts'] = explode('/', $path['call']);


    if ($request_path[1]='') {
      $path['query_utf8'] = urldecode($request_path[1]);
       $path['query'] = utf8_decode(urldecode($request_path[1]));
    $vars = explode('&', $path['query']);
    foreach ($vars as $var) {
      $t = explode('=', $var);
      $path['query_vars'][$t[0]] = $t[1];
    }
    }
   
   
  }
return $path;
}
开发者ID:smilescripts,项目名称:consina_project,代码行数:28,代码来源:fungsi.php


示例13: defineFooter

 /**
  * insere footer na devolutiva
  * 
  * @depends FPDF
  */
 public function defineFooter()
 {
     // printa o protocolo
     //print abaixo eh somente para pag. 2 da devolutiva
     if ($this->objMakePdf->PageNo() == 2) {
         $this->objMakePdf->SetFont('Arial', 'BI', 10);
         //printa num. pagina a esquerda da pagina
         $this->objMakePdf->SetXY(9, -17);
         $numProtocolo = $this->objDevolutive->getProtocolo();
         $protocoloCreateAt = $this->objDevolutive->getProtocoloCreateAt();
         $textoProtocoloDevolutiva = "(PROTOCOLO " . $numProtocolo . utf8_decode(" às ") . $protocoloCreateAt . ")";
         $this->objMakePdf->Cell(8, 10, $textoProtocoloDevolutiva, 0, 0, 'L');
     } else {
         $this->objMakePdf->SetTextColor(51, 51, 51);
         $this->objMakePdf->SetDrawColor(51, 51, 51);
         $this->objMakePdf->SetLineWidth(0.2);
         $this->objMakePdf->line(10, 279, 200, 279);
         #$this->objMakePdf->line(10,280,200,280);
         $this->objMakePdf->SetXY(10, -15);
         #-15);
         $this->objMakePdf->SetFont('Arial', 'BI', 7);
         $mm_distancia_da_margem_esquerda_img1 = 102;
         $mm_distancia_do_topo_img1 = 280;
         $mm_largura_img1 = 100;
         $imagemFooter = $this->objMakePdf->public_path . $this->objMakePdf->getImagemFooter();
         $this->objMakePdf->Image($imagemFooter, $mm_distancia_da_margem_esquerda_img1, $mm_distancia_do_topo_img1, $mm_largura_img1);
         $this->objMakePdf->SetFont('Arial', 'BI', 8);
         $this->objMakePdf->SetXY(30, -17);
         $this->objMakePdf->Cell(20, 10, utf8_decode("{$this->objMakePdf->getEmissao_data()}"), 0, 0, 'C');
         $this->objMakePdf->SetXY(9, -17);
         $this->objMakePdf->Cell(8, 10, $this->objMakePdf->PageNo() . '/{nb}', 0, 0, 'C');
     }
 }
开发者ID:Lazaro-Gallo,项目名称:psmn,代码行数:38,代码来源:FooterPdf.php


示例14: nsBloggerNewPost

 function nsBloggerNewPost($auth, $blogID, $title, $text)
 {
     $text = str_ireplace('allowfullscreen', '', $text);
     $title = utf8_decode(strip_tags($title));
     $text = preg_replace('/<object\\b[^>]*>(.*?)<\\/object>/is', "", $text);
     $text = preg_replace('/<iframe\\b[^>]*>(.*?)<\\/iframe>/is', "", $text);
     $text = utf8_decode($text);
     $postText = '<entry xmlns="http://www.w3.org/2005/Atom"><title type="text">' . $title . '</title><content type="xhtml">' . $text . '</content></entry>';
     //prr($postText);
     $ch = curl_init("https://www.blogger.com/feeds/{$blogID}/posts/default");
     $headers = array("Content-type: application/atom+xml", "Content-Length: " . strlen($postText), "Authorization: GoogleLogin auth=" . $auth, $postText);
     curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0)");
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLINFO_HEADER_OUT, true);
     global $nxs_skipSSLCheck;
     if ($nxs_skipSSLCheck === true) {
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     }
     $result = curl_exec($ch);
     curl_close($ch);
     if (stripos($result, 'tag:blogger.com') !== false) {
         $postID = CutFromTo($result, " rel='alternate' type='text/html' href='", "'");
         return array("code" => "OK", "post_id" => $postID);
     } else {
         return array("code" => "ERR", "error" => $result);
     }
 }
开发者ID:voquanghoa,项目名称:WebPhim,代码行数:31,代码来源:bg.api.php


示例15: normalize

function normalize($text, $separator = "-")
{
    $isUTF8 = mb_detect_encoding($text . " ", 'UTF-8,ISO-8859-1') == 'UTF-8';
    $text = $isUTF8 ? utf8_decode($text) : $text;
    $text = trim($text);
    $_a = utf8_decode("ÁÀãâàá");
    $_e = utf8_decode("ÉÈéè");
    $_i = utf8_decode("ÍÌíì");
    $_o = utf8_decode("ÓÒóò");
    $_u = utf8_decode("ÚÙúù");
    $_n = utf8_decode("Ññ");
    $_c = utf8_decode("Çç");
    $_b = utf8_decode("ß");
    $_dash = "\\.,_ ";
    $text = preg_replace("/[{$_a}]/", "a", $text);
    $text = preg_replace("/[{$_e}]/", "e", $text);
    $text = preg_replace("/[{$_i}]/", "i", $text);
    $text = preg_replace("/[{$_o}]/", "o", $text);
    $text = preg_replace("/[{$_u}]/", "u", $text);
    $text = preg_replace("/[{$_n}]/", "n", $text);
    $text = preg_replace("/[{$_c}]/", "c", $text);
    $text = preg_replace("/[{$_b}]/", "ss", $text);
    $text = preg_replace("/[{$_dash}]/", $separator, $text);
    $text = preg_replace("/[^a-zA-Z0-9\\-]/", "", $text);
    $text = strtolower($text);
    return $isUTF8 ? utf8_encode($text) : $text;
}
开发者ID:jsuarez,项目名称:mydesignArg,代码行数:27,代码来源:util_helper.php


示例16: imprimer

function imprimer($conn, $id, $titre, $photo)
{
    echo '
  <div class="col-md-3 col-sm-6 hero-feature">
    <div class="thumbnail">
      <img src="' . $photo . '" alt="">
      <div class="caption">
        <h3>' . utf8_decode($titre) . '</h3>
        <p>
        ';
    $res = louerpar($conn, $id);
    $nom = odbc_result($res, 1);
    $prenom = odbc_result($res, 2);
    if ($nom) {
        echo 'Appartement loué par : ' . $prenom . '  ' . $nom;
    } else {
        echo 'Appartement Libre';
        if (isAvailable($conn, $id)) {
            echo '<a class="btn btn-primary" href="proprietaire_fonction.php?a=0&id=' . $id . '" >Rendre Indisponible</a>';
        } else {
            echo '<a class="btn btn-primary" href="proprietaire_fonction.php?a=1&id=' . $id . '" >Rendre Disponible</a>';
        }
    }
    echo '
        </p>
      </div>
    </div>
  </div>
  ';
}
开发者ID:Jakkos,项目名称:AppartToutatis,代码行数:30,代码来源:proprietaire.php


示例17: process

 public function process($args)
 {
     $answer = "";
     $args = trim($args);
     if (strlen($args) > 0) {
         $entrada = urlencode($args);
         $url = "https://www.google.com.mx/search?q={$entrada}&oq=200&aqs=chrome.1.69i57j69i59j69i65l2j0l2.3015j0j8&client=ubuntu-browser&sourceid=chrome&es_sm=122&ie=UTF-8";
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.120 Chrome/37.0.2062.120 Safari/537.36');
         $html = curl_exec($ch);
         $web = new DomDocument();
         @$web->loadHTML($html);
         $nodos = @$web->getElementById('topstuff')->getElementsByTagName('div');
         $answer = "No pude convertir lo que me pides.";
         if ($nodos) {
             $nodos = iterator_to_array($nodos);
             if (count($nodos) === 6) {
                 $answer = utf8_decode($nodos[3]->nodeValue . " " . $nodos[4]->nodeValue);
             }
         }
     } else {
         $answer = "Ingresa una expresion.";
     }
     $this->reply($answer, $this->currentchannel, $this->nick);
 }
开发者ID:jahrmando,项目名称:botijon,代码行数:27,代码来源:convertir.php


示例18: ConsultarCEP

function ConsultarCEP($cep)
{
    $url = 'http://www.buscacep.correios.com.br/sistemas/buscacep/resultadoBuscaCepEndereco.cfm';
    $fields = array('relaxation' => urlencode(intval($cep)), 'tipoCEP' => urlencode('ALL'), 'semelhante' => urlencode('N'));
    $fields_string = '';
    foreach ($fields as $key => $value) {
        $fields_string .= $key . '=' . $value . '&';
    }
    rtrim($fields_string, '&');
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, count($fields));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $result = utf8_decode(curl_exec($ch));
    curl_close($ch);
    $doc = new DOMDocument();
    $doc->preserveWhiteSpace = false;
    $doc->strictErrorChecking = false;
    $doc->recover = true;
    $doc->loadHTML(mb_convert_encoding($result, 'HTML-ENTITIES', 'UTF-8'));
    $xpath = new DOMXPath($doc);
    $query = "//table[@class='tmptabela']//td";
    $entries = $xpath->query($query);
    $uf = explode('/', $entries->item(2)->nodeValue)[1];
    $cidade = explode('/', $entries->item(2)->nodeValue)[0];
    $bairro = substr($entries->item(1)->nodeValue, 0, -2);
    $logradouro = substr($entries->item(0)->nodeValue, 0, -2);
    $return = array('uf' => trim($uf), 'cidade' => trim($cidade), 'bairro' => trim($bairro), 'logradouro' => trim($logradouro));
    if (!empty($return)) {
        return $return;
    } else {
        return false;
    }
}
开发者ID:samukt,项目名称:ConsultarCEPCorreios,代码行数:35,代码来源:Cep.php


示例19: googleArray

 /**
  * Returns array, containing detailed results for any Google search.
  *
  * @access       private
  * @param        string        $query      String, containing the search query.
  * @param        string        $tld        String, containing the desired Google top level domain.
  * @return       array                     Returns array, containing the keys 'URL', 'Title' and 'Description'.
  */
 public static function googleArray($query)
 {
     $result = array();
     $pages = 1;
     $delay = 0;
     for ($start = 0; $start < $pages; $start++) {
         $url = 'http://www.google.' . GOOGLE_TLD . '/custom?q=' . $query . '&filter=0' . '&num=100' . ($start == 0 ? '' : '&start=' . $start . '00');
         $str = SEOstats::cURL($url);
         if (preg_match("#answer=86640#i", $str)) {
             $e = 'Please read: http://www.google.com/support/websearch/' . 'bin/answer.py?&answer=86640&hl=en';
             throw new SEOstatsException($e);
         } else {
             $html = new DOMDocument();
             @$html->loadHtml($str);
             $xpath = new DOMXPath($html);
             $links = $xpath->query("//div[@class='g']//a");
             $descs = $xpath->query("//td[@class='j']//div[@class='std']");
             $i = 0;
             foreach ($links as $link) {
                 if (!preg_match('#cache#si', $link->textContent) && !preg_match('#similar#si', $link->textContent)) {
                     $result[] = array('url' => $link->getAttribute('href'), 'title' => utf8_decode($link->textContent), 'descr' => utf8_decode($descs->item($i)->textContent));
                     $i++;
                 }
             }
             if (preg_match('#<div id="nn"><\\/div>#i', $str) || preg_match('#<div id=nn><\\/div>#i', $str)) {
                 $pages += 1;
                 $delay += 200000;
                 usleep($delay);
             } else {
                 $pages -= 1;
             }
         }
     }
     return $result;
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:43,代码来源:seostats.google.php


示例20: clear_input_ruta

 static function clear_input_ruta($data)
 {
     $data = str_replace('\\', '\\\\', $data);
     $data = str_replace('"', '\\"', $data);
     // $data = self::clear_input($data);
     return utf8_decode($data);
 }
开发者ID:claudiospro,项目名称:neointel_proyecto02,代码行数:7,代码来源:utilidades.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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