本文整理汇总了PHP中utf8_encode函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_encode函数的具体用法?PHP utf8_encode怎么用?PHP utf8_encode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utf8_encode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: request
/**
* send function sends the command to the oxD server.
*
* Args:
* command (dict) - Dict representation of the JSON command string
**/
public function request()
{
$this->setParams();
$jsondata = json_encode($this->getData(), JSON_UNESCAPED_SLASHES);
$lenght = strlen($jsondata);
if ($lenght <= 0) {
return array('status' => false, 'message' => 'Sorry .Problem with oxd.');
} else {
$lenght = $lenght <= 999 ? "0" . $lenght : $lenght;
}
$this->response_json = $this->oxd_socket_request(utf8_encode($lenght . $jsondata));
if ($this->response_json != 'Can not connect to oxd server') {
$this->response_json = str_replace(substr($this->response_json, 0, 4), "", $this->response_json);
if ($this->response_json) {
$object = json_decode($this->response_json);
if ($object->status == 'error') {
return array('status' => false, 'message' => $object->data->error . ' : ' . $object->data->error_description);
} elseif ($object->status == 'ok') {
$this->response_object = json_decode($this->response_json);
return array('status' => true);
}
}
} else {
return array('status' => false, 'message' => 'Can not connect to oxd server. Please look file oxd-config.json configuration in your oxd server.');
}
}
开发者ID:GluuFederation,项目名称:gluu-magento-sso-login-extension,代码行数:32,代码来源:ClientOXDRP.php
示例17: onPreInit
public function onPreInit($param)
{
parent::onPreInit($param);
$docname = "tempXML";
$ext = "xml";
$header = "application/xml";
$doc = new TXmlDocument('1.0', 'ISO-8859-1');
$doc->TagName = 'menu';
$doc->setAttribute('id', "0");
$QVFile = new TXmlElement('item');
$QVFile->setAttribute('id', "new_Element");
$QVFile->setAttribute('img', "plus5.gif");
$QVFile->setAttribute('text', "new element");
$ActivityElements = ActivityTypeRecord::finder()->findAll();
foreach ($ActivityElements as $Activitytype) {
$ST = new TXmlElement('item');
$ST->setAttribute('id', $Activitytype->idta_activity_type);
$ST->setAttribute('img', 's' . $Activitytype->idta_activity_type . ".gif");
$ST->setAttribute('text', utf8_encode($Activitytype->act_type_name));
//hier muss die logik fuer die basiswerte aus den dimensionen hin...
//hier hole ich mir die Dimensionsgruppen
$QVFile->Elements[] = $ST;
}
$doc->Elements[] = $QVFile;
// $CMdelete=new TXmlElement('item');
// $CMdelete->setAttribute('id',"delete_Element");
// $CMdelete->setAttribute('img',"minus.gif");
// $CMdelete->setAttribute('text',"delete element");
//
// $doc->Elements[]=$CMdelete;
$this->getResponse()->appendHeader("Content-Type:" . $header);
$this->getResponse()->appendHeader("Content-Disposition:inline;filename=" . $docName . '.' . $ext);
$doc->saveToFile('php://output');
exit;
}
开发者ID:quantrocket,项目名称:planlogiq,代码行数:35,代码来源:TreeActivityMenuConnector.php
示例18: actualizarTabla
function actualizarTabla($archivo_name, $marcado, $etiquetado, $usuario, $comentario)
{
mysql_query("SET NAMES 'utf8'");
$archivo_name = utf8_encode(urldecode($archivo_name));
if ($marcado && $etiquetado) {
$data = array('archivo_name' => $archivo_name, 'ult_marc' => date("Y-m-d H:i"), 'ult_etiq' => date("Y-m-d H:i"), 'usuario_marc' => $usuario, 'usuario_etiq' => $usuario);
$data0 = array('nombre_archivo' => $archivo_name, 'accion' => "Etiquetado + Marcado", 'fecha' => date("Y-m-d H:i"), 'usuario_bitacora' => $usuario, 'comentario' => $comentario);
}
if ($etiquetado && !$marcado) {
$data = array('archivo_name' => $archivo_name, 'ult_etiq' => date("Y-m-d"), 'usuario_etiq' => $usuario);
$data0 = array('nombre_archivo' => $archivo_name, 'accion' => "Etiquetado", 'fecha' => date("Y-m-d H:i"), 'usuario_bitacora' => $usuario, 'comentario' => $comentario);
}
if (!$etiquetado && $marcado) {
$data = array('archivo_name' => $archivo_name, 'ult_marc' => date("Y-m-d"), 'usuario_marc' => $usuario);
$data0 = array('nombre_archivo' => $archivo_name, 'accion' => "Marcado", 'fecha' => date("Y-m-d H:i"), 'usuario_bitacora' => $usuario, 'comentario' => $comentario);
}
if (!$etiquetado && !$marcado) {
$data = array('archivo_name' => $archivo_name);
$data0 = array('nombre_archivo' => $archivo_name, 'accion' => "Lectura", 'fecha' => date("Y-m-d H:i"), 'usuario_bitacora' => $usuario, 'comentario' => $comentario);
}
$this->db->select('*')->from('tabla')->where('archivo_name', $archivo_name);
$query = $this->db->get();
if ($query->num_rows > 0) {
//update
$this->db->where('archivo_name', $archivo_name);
$this->db->update('tabla', $data);
$this->db->insert('bitacora', $data0);
}
//insert
$this->db->insert('tabla', $data);
$this->db->insert('bitacora', $data0);
return TRUE;
}
开发者ID:essajole,项目名称:tesis_Julio_2012,代码行数:33,代码来源:archivo_modelo.php
示例19: process
public function process($content)
{
if ($this->level == 0) {
$this->_moduleChain = array();
}
$this->level++;
// search content for some pattern and call the process...
$d = utf8_encode("þ");
$out = preg_replace_callback("/" . $d . "module \"([a-zA-Z0-9\\/_]+?)\"([^" . $d . "]+?)?" . $d . "/", array(&$this, 'renderModule1'), $content);
// insert css files if necessary
if ($this->cssInline && count($this->cssInclude) > 0) {
$cstring = "";
foreach ($this->cssInclude as $cssin) {
$cstring .= "@import url({$cssin});\n";
}
// now find a place and insert $cstring!!!
$regexp = "/(<style(?:.*?)id=\"internal-style\">)(.*?)(<\\/style>)/s";
$replace = "\\1 \n {$cstring} \n \\2 \\3";
$out = preg_replace($regexp, $replace, $out, 1);
}
// TODO: check if top-level?
if ($this->modulesToProcessPage != null) {
$runData = $this->runData;
foreach ($this->modulesToProcessPage as $module) {
$out = $module->processPage($out, $runData);
}
}
return $out;
}
开发者ID:jbzdak,项目名称:wikidot,代码行数:29,代码来源:ModuleProcessor.php
示例20: create
public static function create($isoLang = 'pt_BR')
{
$xmlDoc = new DOMDocument('1.0', 'utf-8');
$xmlDoc->formatOutput = true;
$culture = $xmlDoc->createElement($isoLang);
$culture = $xmlDoc->appendChild($culture);
$criteria = new Criteria();
$criteria->add(TagI18n::TABLE . '.' . TagI18n::ISOLANG, $isoLang);
$objTagI18n = new TagI18nPeer();
$arrayObjTagI18n = $objTagI18n->doSelect($criteria);
if (!is_object($arrayObjTagI18n) && count($arrayObjTagI18n == 0)) {
$log = new Log();
$log->setLog(__FILE__, 'There are no tags with that language ' . $isoLang, true);
throw new Exception('There are no tags with that language ' . $isoLang);
}
foreach ($arrayObjTagI18n as $objTagI18nPeer) {
$item = $xmlDoc->createElement('item');
$item->setAttribute('idTagI18n', $objTagI18nPeer->getIdTagI18n());
$item = $culture->appendChild($item);
$title = $xmlDoc->createElement('tag', utf8_encode($objTagI18nPeer->getTag()));
$title = $item->appendChild($title);
$link = $xmlDoc->createElement('i18n', utf8_encode($objTagI18nPeer->getTranslate()));
$link = $item->appendChild($link);
}
//header("Content-type:application/xml; charset=utf-8");
$file = PATH . PATH_I18N . $isoLang . '.xml';
try {
file_put_contents($file, $xmlDoc->saveXML());
} catch (Exception $e) {
$log = new Log();
$log->setLog(__FILE__, 'Unable to write the XML file I18n ' . $e->getMessage(), true);
}
return true;
}
开发者ID:suga,项目名称:Megiddo,代码行数:34,代码来源:I18nXml.php
注:本文中的utf8_encode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论