本文整理汇总了PHP中auto_charset函数的典型用法代码示例。如果您正苦于以下问题:PHP auto_charset函数的具体用法?PHP auto_charset怎么用?PHP auto_charset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了auto_charset函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: proxy
public function proxy()
{
$city = t($_REQUEST['city']);
$data = file_get_contents('http://php.weather.sina.com.cn/iframe/index/w_cl.php?day=2&code=js&cbf=show&city=' . $city);
$data = auto_charset($data, 'gb2312', 'utf8');
echo $data;
}
开发者ID:naliduo,项目名称:ThinkSNS,代码行数:7,代码来源:WeatherHooks.class.php
示例2: auto_charset
function auto_charset(&$fContents, $from = 'gbk', $to = 'utf-8')
{
$from = strtoupper($from) == 'UTF8' ? 'utf-8' : $from;
$to = strtoupper($to) == 'UTF8' ? 'utf-8' : $to;
if (strtoupper($from) === strtoupper($to) || empty($fContents) || is_scalar($fContents) && !is_string($fContents)) {
//如果编码相同或者非字符串标量则不转换
return $fContents;
}
if (is_string($fContents)) {
if (function_exists('mb_convert_encoding')) {
return mb_convert_encoding($fContents, $to, $from);
} elseif (function_exists('iconv')) {
return iconv($from, $to, $fContents);
} else {
return $fContents;
}
} elseif (is_array($fContents)) {
foreach ($fContents as $key => $val) {
$_key = auto_charset($key, $from, $to);
$fContents[$_key] = auto_charset($val, $from, $to);
if ($key != $_key) {
unset($fContents[$key]);
}
}
return $fContents;
} else {
return $fContents;
}
}
开发者ID:asonweb,项目名称:mycicms,代码行数:29,代码来源:my_helper.php
示例3: validateUser
public function validateUser()
{
$retcode = "200";
$arr_message = array("result" => "fail", "message" => "操作出现异常,请稍后再试!");
$db = new DB_test();
$phonenumber = trim($this->arr_body['phonenumber']);
$query = "SELECT fd_author_id FROM tb_author WHERE fd_author_username = '" . $phonenumber . "'";
$authorid = $db->get_all($query);
if ($authorid != 0 && count($authorid) > 0) {
$authorid = $authorid[0]["fd_author_id"];
$query = "SELECT Q.fd_question_contect AS que, A.fd_answer AS answer \n\t\t\t\t\tFROM tb_safeguard_secque_useranswer AS A \n\t\t\t\t\tINNER JOIN tb_safeguard_secque AS Q ON A.fd_question_id = Q.fd_question_id \n\t\t\t\t\tWHERE A.fd_author_id = " . $authorid;
$db->query($query);
$retcode = "0";
if ($db->nf() > 0) {
$arr_msg = auto_charset($db->getData('', 'msgbody'), 'gbk', 'utf-8');
$arr_msg['msgbody']['authorid'] = $authorid;
$arr_message = array("result" => "success", "message" => "成功获取密保问题");
} else {
$retcode = "200";
$arr_message = array("result" => "failure", "message" => "您还未设置过密保问题");
}
} else {
$retcode = "200";
$arr_message = array("result" => "failure", "message" => "该手机号还未注册过通付宝账号");
}
$arr_msg['msgbody']['result'] = $arr_message['result'];
$arr_msg['msgbody']['message'] = $arr_message['message'];
$returnvalue = array("msgbody" => $arr_msg['msgbody']);
$returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue);
return $returnval;
}
开发者ID:Xiaoyuyexi,项目名称:client-server,代码行数:31,代码来源:ApiSafeGuard.php
示例4: readKuaiDicmpList
public function readKuaiDicmpList()
{
$db = new DB_test();
$arr_header = $this->arr_header;
$arr_body = $this->arr_body;
$arr_channelinfo = $this->arr_channelinfo;
$apptype = trim($arr_body['apptype']);
$appversion = trim($arr_body['appversion']);
$query = "select fd_kdcompany_id as comid,fd_kdcompany_no as com,fd_kdcompany_name as comname\n\t\t ,fd_kdcompany_api as apitype,fd_kdcompany_pic as comlogo ,fd_kdcompany_phone as comphone from \n\t tb_kdcompany where fd_kdcompany_active = '1' order by fd_kdcompany_api desc";
//只显示激活的列表
$db->query($query);
$arr_msg = auto_charset($db->getData('', 'msgbody'), 'gbk', 'utf-8');
if (!$arr_msg) {
$arr_message = array("result" => "failure", "message" => "列表为空!");
$retcode = "200";
//反馈状态 0 成功 200 自定义错误
} else {
$arr_message = array("result" => "success", "message" => "读取成功!");
$retcode = "0";
//反馈状态 0 成功 200 自定义错误
}
$arr_msg['msgbody']['result'] = $arr_message['result'];
$arr_msg['msgbody']['message'] = $arr_message['message'];
$returnvalue = array("msgbody" => $arr_msg['msgbody']);
$returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue);
return $returnval;
}
开发者ID:Xiaoyuyexi,项目名称:client-server,代码行数:27,代码来源:ApiKuaiDiinfo.php
示例5: getAllExpression
public function getAllExpression($flush = false)
{
$cache_id = '_model_expression';
if (($res = F($cache_id)) === false || $flush === true) {
global $ts;
$pkg = $ts['site']['expression'];
$filepath = SITE_PATH . '/public/themes/' . $ts['site']['site_theme'] . '/images/expression/' . $pkg;
require_once ADDON_PATH . '/libs/Io/Dir.class.php';
$expression = new Dir($filepath);
$expression_pkg = $expression->toArray();
$res = array();
foreach ($expression_pkg as $value) {
if (!is_utf8($value['filename'])) {
$value['filename'] = auto_charset($value['filename'], 'GBK', 'UTF8');
}
list($file) = explode(".", $value['filename']);
$temp['title'] = $file;
$temp['emotion'] = '[' . $file . ']';
$temp['filename'] = $value['filename'];
$temp['type'] = $pkg;
$res[$temp['emotion']] = $temp;
}
F($cache_id, $res);
}
return $res;
}
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:26,代码来源:ExpressionModel.class.php
示例6: lists
private function lists($order = '')
{
if (empty($order)) {
$order = 'id desc';
}
$status = $this->input->get('status') === false ? '1' : $this->input->get('status');
$count = $this->db->order_by($order)->where('status', $status)->get($this->table);
$count = $count->result_array();
if (count($count) > 0) {
//分页 1.load 分页类,2.加载分页配置,
$this->load->library('pagination');
$this->config->load('pagination');
$pageconfig = $this->config->item('pagination');
$pageconfig['total_rows'] = count($count);
$pageconfig['base_url'] = site_url('user/index');
if (count($count) < $pageconfig['per_page']) {
auto_charset($count);
return array('lists' => $count);
}
$offset = $pageconfig['per_page'] * ($this->uri->segment(3, 1) - 1);
//return resource object
$query = $this->db->_execute("select * from as_" . $this->table . "order by " . $order);
$lists = $this->db->limit_access($query, $offset, $pageconfig['per_page']);
$pages = $this->paged($pageconfig);
$lists = auto_charset($lists);
$r = array('lists' => $lists, 'pages' => $pages);
return $r;
} else {
return null;
}
}
开发者ID:asonweb,项目名称:mycicms,代码行数:31,代码来源:users_model.php
示例7: readHelpList
public function readHelpList()
{
$db = new DB_test();
$arr_header = $this->arr_header;
$arr_body = $this->arr_body;
$arr_channelinfo = $this->arr_channelinfo;
$msgstart = $arr_body['msgstart'] + 0;
$msgdisplay = $arr_body['msgdisplay'] + 0;
if ($msgstart < 0) {
$msgstart = 0;
}
$query = "select 1 from web_help order by fd_help_no ";
$db->query($query);
$msgallcount = $db->nf();
$query = "select fd_help_id as helpid ,fd_help_name as helpname,fd_help_contect as helpcontent,\n\t fd_help_date as helpdate from web_help order by fd_help_no limit {$msgstart}, {$msgdisplay} ";
$db->query($query);
$msgdiscount = $db->nf();
$arr_msg = auto_charset($db->getData('', 'msgbody'), 'gbk', 'utf-8');
$arr_message = array("result" => "success", "message" => "读取成功!");
$retcode = "0";
//反馈状态 0 成功 200 自定义错误
$arr_msg['msgbody']['msgallcount'] = $msgallcount;
$arr_msg['msgbody']['msgdiscount'] = $msgdiscount + $msgstart;
$arr_msg['msgbody']['result'] = $arr_message['result'];
$arr_msg['msgbody']['message'] = $arr_message['message'];
$returnvalue = array("msgbody" => $arr_msg['msgbody']);
$returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue);
return $returnval;
}
开发者ID:Xiaoyuyexi,项目名称:client-server,代码行数:29,代码来源:ApiAppHelpinfo.php
示例8: analyseContent
public function analyseContent($file_contents, $key = '', &$errMsg, &$retCode)
{
$logger = Logger::getLogger('Ofpay');
$logger->debug("开始解析欧飞返回的数据(" . $file_contents . ")");
$file_contents = auto_charset($file_contents, 'gbk', 'utf-8');
$file_contents = str_replace("gb2312", "utf-8", $file_contents);
$file_contents = str_replace("GB2312", "utf-8", $file_contents);
$file_contents = simplexml_load_string($file_contents);
$logger->debug("开始把数据解析成xml格式:" . $key);
foreach ($file_contents->children() as $item) {
switch ($item->getName()) {
case "err_msg":
$errMsg = (string) $item;
break;
case "retcode":
$retCode = (int) $item;
break;
case $key:
return $item;
default:
$msgBody = $item;
}
}
return $msgBody;
}
开发者ID:Xiaoyuyexi,项目名称:client-server,代码行数:25,代码来源:ofpayV2.class.php
示例9: toDate
function toDate($time, $format = 'Y年m月d日 H:i:s')
{
if (empty($time)) {
return '';
}
$format = str_replace('#', ':', $format);
return date(auto_charset($format), $time);
}
开发者ID:lee99,项目名称:tpmaker,代码行数:8,代码来源:common_bak.php
示例10: edit
function edit($id)
{
$this->db->where('id', intval($id));
$result = $this->db->get('comments')->result_array();
$result = array_shift($result);
auto_charset($result);
$this->data['form'] = $result;
Displayview::display('comment/edit.html', $this->data);
}
开发者ID:asonweb,项目名称:mycicms,代码行数:9,代码来源:comment.php
示例11: view
function view($type, $id)
{
//内容类型
$this->type = $this->types[$type];
$query = $this->db->where('id', intval($id))->get('contents');
$data = auto_charset($query->row_array());
//views
$this->data['head'] = $this->parser->parse('home/head-page', $this->pagedata, true);
$this->data['header'] = $this->parser->parse('home/header.html', $this->pagedata, true);
$this->data['footer'] = $this->parser->parse('home/footer.html', $this->pagedata, true);
$this->data['content'] = $data;
$this->parser->parse($this->type['tpl'], $this->data);
}
开发者ID:asonweb,项目名称:mycicms,代码行数:13,代码来源:index.php
示例12: Delete
function Delete()
{
$id = $_REQUEST['id'];
$map['id'] = array('in', $id);
if ($list = $this->dao->where($map)->findall()) {
$img = auto_charset($list['imgurl'], 'utf-8', 'gbk');
if (file_exists($img)) {
unlink($img);
}
$this->dao->where($map)->delete();
}
$this->success("删除成功!");
}
开发者ID:dalinhuang,项目名称:concourse,代码行数:13,代码来源:BrandAction.class.php
示例13: getStatus
function getStatus($status, $imageShow = true)
{
switch ($status) {
case 0:
$showText = '未处理';
$showImg = '<IMG SRC="' . APP_PUBLIC_URL . '/Images/state0.bmp" BORDER="0" ALT="未处理">';
break;
case 1:
default:
$showText = '已处理';
$showImg = '<IMG SRC="' . APP_PUBLIC_URL . '/Images/state1.bmp" BORDER="0" ALT="已处理">';
}
return $imageShow === true ? auto_charset($showImg) : $showText;
}
开发者ID:kenlong,项目名称:example,代码行数:14,代码来源:common.php
示例14: CreateOrder
public function CreateOrder($msgBody, $authorId, $payType)
{
$now = time();
$logger = Logger::getLogger('mobilerecharge');
$logger->debug("开始创建手机充值订单({$now})");
$arrPayCard = GetPayCalcuInfo::readpaycardid($msgBody['paycardid'], $authorId);
// ******
$logger->debug("正在创建手机充值订单({$now}) : paycardid(" . $msgBody['paycardid'] . "),authorId({$authorId} ),arrPayCard(" . print_r($arrPayCard, true) . ")");
$payCardId = $arrPayCard['paycardid'];
// 刷卡器ID
$cusId = $arrPayCard['cusid'];
// 代理商ID
$payfee = 0;
// 利润 = 用户支付给通付宝的钱 - 通付宝从向上的进货价- 支付通道的费率
$query = "SELECT (fd_recham_paymoney - fd_recham_costmoney) AS payfee \n\t\t\t\tFROM tb_mobilerechamoney WHERE fd_recham_money = '" . $msgBody['rechargeMoney'] . "'";
$db = new DB_test();
$dataInDB = $db->get_all($query);
if (is_array($dataInDB) && count($dataInDB) == 1) {
$payfee = $dataInDB[0]['payfee'];
$logger->debug("正在创建手机充值订单({$now}) : 用户支付给通付宝的钱 - 通付宝从向上的进货价 = ({$payfee})");
} else {
$logger->error("正在创建手机充值订单({$now}) : 无法获取面额" . $msgBody['rechargeMoney'] . "元所对应的利润值");
}
$payTypeFee = 0;
// 转账费率
switch ($payType) {
case "YiBao":
$payTypeFee = YiBaoPay::GetPayFee($msgBody['payMoney']);
break;
case "upmp":
$payTypeFee = BankPayInfoV3::GetPayFee($msgBody['payMoney']);
break;
}
// ********
$cusfeeResult = getcusfenrun::get_cusfenrun($cusId, "mobilerecharge", $msgBody['payMoney'], 0, $payfee, 0, date("Y-m-d"), null, null);
//$cusfeeResult = getcusfenrun :: get_cusfenrun($cusId, "mobilerecharge", $msgBody['payMoney'], $payTypeFee, $payfee, 0, date("Y-m-d"), null, null);
$logger->debug("正在创建手机充值订单({$now}) : cusId({$cusId} ),cusfeeResult(" . print_r($cusfeeResult, true) . ")");
$cusfee = $cusfeeResult["cusfee"];
$cusfee = $cusfee > 0 ? $cusfee : 0;
$logger->debug("正在创建手机充值订单({$now}) : 通付宝的利润({$payfee}), 代理商的利润({$cusfee})");
$orderNumber = "tfbmrc" . date("YmdHiss") . mt_rand(1000, 9999);
// 创建通付宝订单号
$listno = makeorderno("mobilerechargelist", "mrclist", "mrc");
// ******
$sql = "INSERT INTO tb_mobilerechargelist(fd_mrclist_no, fd_mrclist_paycardid, fd_mrclist_cusid, \n\t\t\t\tfd_mrclist_cusfee, fd_mrclist_authorid, fd_mrclist_paydate, \n\t\t\t\tfd_mrclist_bkordernumber, fd_mrclist_sdcrid, fd_mrclist_payrq, fd_mrclist_paytypeid, \n\t\t\t\tfd_mrclist_paytype, fd_mrclist_rechamoney, fd_mrclist_bkmoney, fd_mrclist_rechaphone, \n\t\t\t\tfd_mrclist_paymoney, fd_mrclist_payfee, fd_mrclist_mobileprov, fd_mrclist_bankcardno, \n\t\t\t\tfd_mrclist_state, fd_mrclist_date, fd_mrclist_datetime) VALUES \n\t\t\t\t('{$listno}', '{$payCardId}', '{$cusId}', \n\t\t\t\t'{$cusfee}', '{$authorId}', NOW(), \n\t\t\t\t'{$orderNumber}', 3, '01', '1', \n\t\t\t\t'mobilerecharge', '" . $msgBody['rechargeMoney'] . "', '" . $msgBody['payMoney'] . "', '" . $msgBody['rechargePhone'] . "', \n\t\t\t\t'" . $msgBody['payMoney'] . "', '{$payfee}', '" . $msgBody['mobileProvince'] . "', '" . $msgBody['bankCardId'] . "', \n\t\t\t\t'0', NOW(), NOW());";
$logger->debug("正在创建手机充值订单({$now}) : ({$sql})");
$sql = auto_charset($sql, 'utf-8', 'gbk');
$db->query($sql);
return $orderNumber;
}
开发者ID:Xiaoyuyexi,项目名称:client-server,代码行数:50,代码来源:mobilerecharge.php
示例15: getStatus
function getStatus($status, $imageShow = true)
{
switch ($status) {
case 0:
$showText = '禁用';
$showImg = '<IMG SRC="../Public/images/locked.gif" WIDTH="20" HEIGHT="20" BORDER="0" ALT="禁用">';
break;
case 1:
default:
$showText = '正常';
$showImg = '<IMG SRC="../Public/images/ok.gif" WIDTH="20" HEIGHT="20" BORDER="0" ALT="正常">';
}
return $imageShow === true ? auto_charset($showImg) : $showText;
}
开发者ID:wangping1987,项目名称:dhfriendluck,代码行数:14,代码来源:common.php
示例16: download
public function download()
{
import("@.ORG.Http");
$id = $_GET['id'];
$dao = M("Attach");
$attach = $dao->where("id=" . $id)->find();
$filename = $attach["savepath"] . $attach["savename"];
if (is_file($filename)) {
if (!isset($_SESSION['attach_down_count_' . $id])) {
$dao->setInc('downCount', "id=" . $id);
$_SESSION['attach_down_count_' . $id] = true;
}
Http::download($filename, auto_charset($attach->name, 'utf-8', 'gbk'));
}
}
开发者ID:yunsite,项目名称:wentaowang,代码行数:15,代码来源:PublicAction.class.php
示例17: down
public function down()
{
$aid = I('get.attach_id');
$attach = D('Attach/Attach')->find($aid);
if (!$attach) {
die(L('PUBLIC_ATTACH_ISNULL'));
}
$filename = $attach['filepath'] . $attach['savename'];
$realname = auto_charset($attach['name'], 'UTF-8', 'GBK//IGNORE');
if (file_exists($filename)) {
Http::download($filename, $realname);
} else {
die(L('PUBLIC_ATTACH_ISNULL'));
}
}
开发者ID:BellyWong,项目名称:ebtAdmin,代码行数:15,代码来源:UploadWidget.class.php
示例18: getagentprodure
public static function getagentprodure($cusid)
{
$db = new DB_test();
$query = "select fd_cus_fenrunid as fenrunid from tb_customer where fd_cus_id = '{$cusid}' ";
if ($db->execute($query)) {
$arr_cus = $db->get_one($query);
$fenrunid = $arr_cus['fenrunid'];
}
$query = "select fd_fenrun_agentprodureid as agentprodureid,fd_fenrun_agentprodure as agentprodure,fd_fenrun_agentprice as agentprice,\n fd_fenrun_limitmaxnum as limitmaxnum,fd_fenrun_limitminnum as limitminnum\n from tb_cus_fenrunset where fd_fenrun_id = '{$fenrunid}' ";
if ($db->execute($query)) {
$arr_fenrun = $db->get_one($query);
$arr_fenrun = auto_charset($arr_fenrun, 'gbk', 'utf-8');
}
return $arr_fenrun;
}
开发者ID:Xiaoyuyexi,项目名称:client-server,代码行数:15,代码来源:getcusfenrun.php
示例19: getorderinfo
public function getorderinfo($querywhere, $start, $display)
{
$dbmsale = new DB_mssale();
if ($start < 0) {
$start = 0;
}
$start = $start + 0;
$display = $display + 0;
$query = "select 1 from web_order where 1=1 {$querywhere} ";
$dbmsale->query($query);
$msgallcount = $dbmsale->nf();
$wfstate = '未付款';
$wfstate = u2g($wfstate);
$yfstate = '已付款';
$yfstate = u2g($yfstate);
$qfstate = '其他';
$qfstate = u2g($qfstate);
$query = "select case \n\t when fd_order_state ='6' then '" . $wfstate . "'\n\t when fd_order_state ='7' then '" . $yfstate . "'\n\t else '" . $qfstate . "' END orderstate,fd_order_id as orderid,fd_order_no as orderno ,\n\t\t fd_order_date as ordertime ,fd_order_allmoney as ordermoney,fd_order_alldunshu as orderpronum,\n\t\t fd_order_type as orderpaytype,fd_order_shman as shman,fd_order_comnpany as shcmpyname,\n\t\t fd_order_receiveadderss as shaddress , '' as fhstorage,'' as fhwltype,\n\t\t fd_order_memo as ordermemo,'' as allpromoney,'' as fhwlmoney\n\t\t from web_order " . "where 1=1 {$querywhere} limit {$start} ,{$display}";
$dbmsale->query($query);
//echo $query;
$msgdiscount = $dbmsale->nf();
$arr_value = $dbmsale->getData('', 'msorder');
//$arr_orderinfo = $dbmsale->get_all($query);
foreach ($arr_value as $key => $value) {
foreach ($value as $k => $v) {
$orderid = $v['orderid'];
$query = "select fd_orderdetail_quantity as pronum,fd_orderdetail_productname as proname,\n\t\t\t\t\t fd_orderdetail_price as proprice \n\t\t\t\t\t ,(fd_orderdetail_price*fd_orderdetail_quantity) as promoney from web_orderdetail \n\t\t\t\t\t where fd_orderdetail_orderid ='{$orderid}'";
$dbmsale->query($query);
//echo $query;
if ($dbmsale->nf()) {
$arr_value[$key][$k]['msproinfo'] = $dbmsale->getFiledData('msgchild');
}
}
}
if (!$arr_value) {
$arr_message = array("result" => "failure", "message" => "很抱歉,没有找到相关的订单信息!");
} else {
$arr_message = array("result" => "success", "message" => "读取成功");
}
//echo var_dump($arr_value);
$arr_message = auto_charset($arr_message, 'utf-8', 'gbk');
$arr_msg['msgbody'] = $arr_value;
$arr_msg['msgbody']['result'] = $arr_message['result'];
$arr_msg['msgbody']['message'] = $arr_message['message'];
$arr_msg['msgbody']['msgallcount'] = $msgallcount;
$arr_msg['msgbody']['msgdiscount'] = $msgdiscount + $start;
return $arr_msg['msgbody'];
}
开发者ID:Xiaoyuyexi,项目名称:client-server,代码行数:48,代码来源:mssale.class.php
示例20: del_attrs
public function del_attrs($products_id)
{
if ($products_id) {
$map['products_id'] = array('in', $products_id);
$list = $this->where($map)->findall();
if ($list) {
foreach ($list as $k => $v) {
$v['img_url'] = auto_charset($v['img_url'], 'utf-8', 'gbk');
if (file_exists($v['img_url'])) {
unlink($v['img_url']);
}
}
}
$this->where($map)->delete();
}
}
开发者ID:dalinhuang,项目名称:concourse,代码行数:16,代码来源:Products_attrModel.class.php
注:本文中的auto_charset函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论