本文整理汇总了PHP中array_iconv函数的典型用法代码示例。如果您正苦于以下问题:PHP array_iconv函数的具体用法?PHP array_iconv怎么用?PHP array_iconv使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了array_iconv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public function login()
{
$username = jget('username', 'txt');
$password = jget('password');
$openid = jget('openid');
if ($username == "" || $password == "") {
json_error("无法登录,用户名或密码不能为空");
}
if ($this->Config['login_by_uid']) {
is_numeric($username) && json_error("禁止使用UID登录");
}
if ($GLOBALS['_J']['plugins']['func']['login']) {
hookscript('login', 'funcs', array('param' => $this->Post, 'step' => 'check'), 'login');
}
$rets = jsg_member_login($username, $password);
$uid = (int) $rets['uid'];
if ($uid < 1) {
json_error(array_iconv($this->Config['charset'], 'utf-8', $rets['error']));
}
$r = false;
if ($openid && $uid) {
$r = jlogic('wechat')->do_bind($openid, $uid);
}
if ($r) {
json_result("绑定成功!");
} else {
json_error("绑定失败!");
}
}
示例2: MasterObject
function MasterObject(&$config, $auto_run = false)
{
if (!$config['wap']) {
include ROOT_PATH . 'wap/include/error_wap.php';
exit;
}
$this->Config = $config;
require_once ROOT_PATH . 'wap/include/func/wap_global.func.php';
$this->Get =& $_GET;
$this->Post =& $_POST;
$this->Module = get_param('mod');
$this->Code = get_param('code');
$this->DatabaseHandler =& Obj::registry('DatabaseHandler');
$this->MemberHandler = jclass('member');
$this->MemberHandler->init();
if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) {
$member_error = $this->MemberHandler->GetError();
$member_error = array_iconv($this->Config['charset'], 'utf-8', $member_error);
$this->Messager($member_error, null);
}
if (!in_array($this->Module, array('member', 'login', 'other'))) {
$visit_rets = $this->MemberHandler->visit();
if ($visit_rets['error']) {
$this->Messager(null, 'index.php?mod=login&referer=' . urlencode('index.php?' . $_SERVER['QUERY_STRING']));
}
}
$this->Title = $this->MemberHandler->CurrentAction['name'];
Obj::register("MemberHandler", $this->MemberHandler);
if ($this->auto_run || $auto_run) {
$this->auto_run();
}
}
示例3: save
function save()
{
if (true === ENC_IS_GBK && ($_REQUEST['in_ajax'] || true === X_IS_AJAX)) {
$_POST = array_iconv('UTF-8', 'GBK', $_POST);
}
logic('tag')->save();
}
示例4: _format
private function _format($id, $data, $type)
{
switch ($type) {
case '1':
// json
if (CHARSET == 'gbk') {
$data = array_iconv($data, 'gbk', 'utf-8');
}
return json_encode($data);
break;
case '2':
// xml
$xml = Loader::lib('Xml');
return $xml->xml_serialize($data);
break;
case '3':
// js
Loader::func('dbsource:global');
ob_start();
include template_url($id);
$html = ob_get_contents();
ob_clean();
return format_js($html);
break;
}
}
示例5: kaixin_sync
function kaixin_sync($data)
{
$sys_config = kaixin_init();
if (!$sys_config) {
return 'kaixin_init is invalid';
}
$tid = is_numeric($data['tid']) ? $data['tid'] : 0;
if ($tid < 1) {
return 'tid is invalid';
}
$uid = is_numeric($data['uid']) ? $data['uid'] : 0;
if ($uid < 1) {
return 'uid is invalid';
}
$totid = is_numeric($data['totid']) ? $data['totid'] : 0;
$content = $data['content'];
if (false !== strpos($content, '[')) {
$content = preg_replace('~\\[([^\\]]{1,6}?)\\]~', '(#\\1)', $content);
}
$content = array_iconv($sys_config['charset'], 'UTF-8', trim(strip_tags($content)));
if (!$content) {
return 'content is invalid';
}
$content .= " " . get_full_url($sys_config['site_url'], 'index.php?mod=topic&code=' . $tid);
$kaixin_bind_info = kaixin_bind_info($uid);
if (!$kaixin_bind_info) {
return 'bind_info is empty';
}
if (!kaixin_has_bind($uid)) {
return 'bind_info is invalid';
}
$kaixin_bind_topic = DB::fetch_first("select * from " . DB::table('kaixin_bind_topic') . " where `tid`='{$tid}'");
if ($kaixin_bind_topic) {
return 'bind_topic is invalid';
} else {
DB::query("insert into " . DB::table('kaixin_bind_topic') . " (`tid`) values ('{$tid}')");
}
$ret = array();
if ($totid < 1) {
$p = array();
$p['access_token'] = $kaixin_bind_info['token'];
$p['content'] = $content;
$imageid = (int) $data['imageid'];
if ($imageid > 0 && $sys_config['kaixin']['is_sync_image']) {
$topic_image = topic_image($imageid, 'original');
if (is_image(ROOT_PATH . $topic_image)) {
$p['picurl'] = $sys_config['site_url'] . '/' . $topic_image;
$p['save_to_album'] = 1;
}
}
$ret = kaixin_api('records/add', $p);
}
$kaixin_id = is_numeric($ret['rid']) ? $ret['rid'] : 0;
if ($kaixin_id > 0) {
DB::query("UPDATE " . DB::table('kaixin_bind_topic') . " SET `kaixin_id`='{$kaixin_id}' WHERE `tid`='{$tid}'");
}
return $ret;
}
示例6: convert
function convert($string)
{
global $_J;
$charset = $_J['charset'];
if (preg_match("/gbk/is", $charset)) {
if (is_array($string)) {
$string = array_iconv($charset, OUT_CHARSET, $string);
} else {
$string = iconv($charset, OUT_CHARSET, $string);
}
}
return $string;
}
示例7: widget_output
function widget_output($result, $status = '', $code = 0)
{
$outputs = array();
if ($status) {
$outputs['status'] = $status;
$outputs[$status] = true;
}
if ($code) {
$outputs['code'] = $code;
}
$outputs['result'] = $result;
$outputs = array_iconv($GLOBALS['_J']['charset'], 'utf-8', $outputs);
ob_clean();
echo json_encode($outputs);
}
示例8: _get_data
/**
* 请求远程数据
* @param string $url 需要请求的地址。
* @param string $backurl 返回地址
*/
private static function _get_data($url, $backurl = '')
{
if ($data = @file_get_contents(self::$server_url . $url)) {
$data = json_decode($data, true);
//如果系统是GBK的系统,把UTF8转码为GBK
if (pc_base::load_config('system', 'charset') == 'gbk') {
$data = array_iconv($data, 'utf-8', 'gbk');
}
if ($data['status'] != 1) {
showmessage($data['msg'], $backurl);
} else {
return $data['msg'];
}
} else {
showmessage(L('your_server_it_may_not_have_access_to') . self::$server_url . L('_please_check_the_server_configuration'));
}
}
示例9: array_iconv
public function array_iconv($data, $encodedTypeOut = null)
{
$this->_setEncodedTypeOut($encodedTypeOut);
$encoded = mb_detect_encoding($data, $this->encodedTypeIn);
//自动判断编码
if (!is_array($data)) {
return mb_convert_encoding($data, $this->encodedTypeOut, $this->encodedTypeIn);
} else {
foreach ($data as $key => $val) {
if (is_array($val)) {
$data[$key] = array_iconv($val, $this->encodedTypeOut);
} else {
$data[$key] = mb_convert_encoding($data, $this->encodedTypeOut, $this->encodedTypeIn);
}
}
return $data;
}
}
示例10: listing
/**
* 栏目列表
*/
public function listing()
{
$cid = isset($GLOBALS['cid']) ? intval($GLOBALS['cid']) : MSG(L('parameter_error'));
$category = get_cache('category_' . $cid, 'content');
//分页初始化
$page = max(intval($GLOBALS['page']), 1);
$pagesize = isset($GLOBALS['pagesize']) ? intval($GLOBALS['pagesize']) : 20;
$model_r = get_cache('model_content', 'model');
$master_table = $model_r[$category['modelid']]['master_table'];
if ($category['type'] == 1) {
$r = $this->db->get_one($master_table, array('cid' => $cid));
if ($r) {
extract($r, EXTR_SKIP);
if ($attr_table = $model_r[$category['modelid']]['attr_table']) {
$r = $this->db->get_one($attr_table, array('id' => $id));
json_encode($r);
}
}
} else {
if ($category['child']) {
$this->childs = '';
$this->get_child($cid);
$cids = implode(',', $this->childs);
$where = '`cid` IN (' . $cids . ') AND `status`=9';
} else {
$where = "`cid`='{$cid}' AND `status`=9";
}
$result = $this->db->get_list($master_table, $where, '*', 0, $pagesize, $page, 'sort DESC,id DESC');
if (empty($result)) {
echo json_encode('finish');
exit;
}
foreach ($result as $key => $rs) {
$result[$key]['catname'] = $this->categorys[$rs['cid']]['name'];
$result[$key]['updatetime'] = date('Y-m-d', $rs['updatetime']);
}
if (strtolower(CHARSET) == 'gbk') {
$result = array_iconv('gbk', 'utf-8', $result);
}
echo json_encode($result);
}
}
示例11: getcitybyapi
/**
* 通过外部接口方式获取详细地址信息
* @return $localinfo province 省份 city城市 sp网络 提供商 pinyin拼音
*/
public function getcitybyapi($ip) {
$api_url = $localinfo = '';
$xml = pc_base::load_sys_class('xml');
pc_base::load_sys_func('iconv');
$api_url = 'http://ipquery.sdo.com/getipinfo.php?ip='.$ip;
$data = $xml->xml_unserialize(@file_get_contents($api_url));
if (CHARSET == 'gbk') {
$data = !empty($data) ? array_iconv($data, 'utf-8', 'gbk') : array();
}
if($data['ip']['result']) {
$localinfo['province'] = $data['ip']['country'];
$localinfo['city'] = $data['ip']['city'];
$localinfo['sp'] = $data['ip']['sp'];
//$name = strtolower(CHARSET) == 'gbk' ? $localinfo['city'] : iconv(CHARSET,'gbk',$localinfo['city']);
$name = str_replace(L('city'),'',$localinfo['city']);
$letters = gbk_to_pinyin($name);
$localinfo['pinyin'] =strtolower(implode('', $letters));
}
return $localinfo;
}
示例12: push_msg
function push_msg($uids, $msg = '')
{
if ($GLOBALS['_J']['config']['iphone_push_enable'] && $this->passphrase && $this->pem && $uids && $msg) {
$tokens = $this->get_token($uids);
}
if ($tokens) {
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', $this->pem);
stream_context_set_option($ctx, 'ssl', 'passphrase', $this->passphrase);
$fp = stream_socket_client('ssl:/' . '/gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx);
if ($fp) {
$body['aps'] = array('alert' => array_iconv(strtolower($GLOBALS['_J']['charset']), 'utf-8', $msg), 'sound' => 'default');
$payload = json_encode($body);
foreach ($tokens as $token) {
$pushmsg = chr(0) . pack('n', 32) . pack('H*', $token) . pack('n', strlen($payload)) . $payload;
fwrite($fp, $pushmsg, strlen($pushmsg));
}
fclose($fp);
}
}
}
示例13: insert_data
function insert_data($array,$father='')
{ $i = 0;
foreach ($array as $key => $dir) {
if (is_array($dir)){
$this->insert_data($dir,$key);
}elseif($key!='path'){
//初始化插入数据
$i++;
$pic_name = array_iconv($dir);
$file_path = array_iconv($father);
$where = array('cat_original_name' => $file_path);
$get_data = $this->product_cat->get_one($where, 'cat_id');
$in_post = array(
'cat_id' => $get_data[cat_id],
'img_path' => array_iconv($array[path]).'/'.$pic_name,
'original_name' => $pic_name,
);
if($i == 1)$in_post[is_thumb] = 1;
$this->insert($in_post);
}
}
}
示例14: Pic
public function Pic()
{
$page = $_GET['page'] ? (int) $_GET['page'] : 0;
if ($page) {
$limit = '40,1000';
} else {
$limit = 40;
}
$r = jlogic('image')->get(array('where' => 'tid > 0', 'order' => 'id DESC', 'limit' => $limit));
foreach ($r['list'] as $value) {
$value['pics'] = topic_image($value['id'], 'small', 0);
$value['pico'] = topic_image($value['id'], 'default', 0);
$value['link'] = $this->Config[site_url] . '/index.php?mod=topic&code=' . $value['tid'];
$topic_list[] = $value;
}
$rss = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n";
$rss .= "<rss version=\"2.0\" xmlns:media=\"http:/" . "/search.yahoo.com/mrss/\" xmlns:atom=\"http:/" . "/www.w3.org/2005/Atom\">\r\n";
$rss .= "<channel>\r\n";
$rss .= "<title>photo</title>\r\n";
$rss .= "<link>{$this->Config[site_url]}</link>\r\n";
$rss .= "<description>photo</description>\r\n";
$rss .= "<language>zh_CN</language>\r\n";
$rss .= "<pubDate>" . Date('Y-m-d H:i:s', time()) . "</pubDate>\r\n";
$rss .= "<atom:link href=\"{$this->Config[site_url]}/index.php?mod=rss\" rel=\"self\" type=\"application/rss+xml\" />\r\n";
$rss .= "<atom:link rel=\"next\" href=\"{$this->Config[site_url]}/index.php?mod=rss&page=2\" />\r\n";
foreach ($topic_list as $val) {
$val['name'] = array_iconv($GLOBALS['_J']['charset'], 'utf-8', $val['name']);
$rss .= "<item>\r\n";
$rss .= "<title><![CDATA[{$val['name']}]]></title>\r\n";
$rss .= "<link>{$val['link']}</link>\r\n";
$rss .= "<media:thumbnail url=\"{$val['pics']}\"/>\r\n";
$rss .= "<media:content url=\"{$val['pico']}\"/>\r\n";
$rss .= "<guid isPermaLink=\"false\">{$val['link']}</guid>\r\n";
$rss .= "</item>\r\n";
}
$rss .= "</channel>\r\n</rss>";
return $rss;
}
示例15: import
public function import()
{
if (isset($_POST['dosubmit'])) {
$type = isset($_POST['type']) && trim($_POST['type']) ? trim($_POST['type']) : showmessage(L('illegal_operation'), HTTP_REFERER);
if ($type == 1) {
$filename = $_FILES['file']['tmp_name'];
if (strtolower(substr($_FILES['file']['name'], -3, 3)) != 'txt') {
showmessage(L('only_allowed_to_upload_txt_files'), HTTP_REFERER);
}
$code = json_decode(base64_decode(file_get_contents($filename)), true);
@unlink($filename);
} elseif ($type == 2) {
$code = isset($_POST['code']) && trim($_POST['code']) ? json_decode(base64_decode(trim($_POST['code'])), true) : showmessage(L('illegal_operation'), HTTP_REFERER);
if (!isset($code['dirname'])) {
showmessage(L('illegal_parameters'), HTTP_REFERER);
}
}
if (pc_base::load_config('system', 'charset') == 'gbk') {
$code = array_iconv($code, 'utf-8', 'gbk');
}
echo $this->filepath . $code['dirname'] . DIRECTORY_SEPARATOR . 'config.php';
if (!file_exists($this->filepath . $code['dirname'] . DIRECTORY_SEPARATOR . 'config.php')) {
if (@is_writable($this->filepath . $code['dirname'] . DIRECTORY_SEPARATOR)) {
@mkdir($this->filepath . $code['dirname'] . DIRECTORY_SEPARATOR, 0755, true);
@file_put_contents($this->filepath . $code['dirname'] . DIRECTORY_SEPARATOR . 'config.php', '<?php return ' . var_export($code, true) . ';?>');
showmessage(L('operation_success'), HTTP_REFERER, '', 'import');
} else {
showemssage(L('template_directory_not_write'), HTTP_REFERER);
}
} else {
showmessage(L('file_exists'), HTTP_REFERER);
}
} else {
$show_header = true;
include $this->admin_tpl('style_import');
}
}