本文整理汇总了PHP中show_json函数的典型用法代码示例。如果您正苦于以下问题:PHP show_json函数的具体用法?PHP show_json怎么用?PHP show_json使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show_json函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: del
/**
* 删除
*/
public function del()
{
if ($this->sql->delete($this->in['name'])) {
show_json($this->L['success']);
}
show_json($this->L['error'], false);
}
示例2: _getData
public function _getData()
{
if (!$this->in['name'] || !$this->in['path'] || !$this->in['type']) {
show_json($this->L["data_not_full"], false);
}
$in = array('mtime' => time(), 'sid' => $this->in['sid'], 'type' => $this->in['type'], 'path' => $this->in['path'], 'name' => $this->in['name'], 'time_to' => $this->in['time_to'] ? $this->in['time_to'] : '', 'share_password' => $this->in['share_password'] ? $this->in['share_password'] : '', 'code_read' => $this->in['code_read'] ? $this->in['code_read'] : '', 'not_download' => $this->in['not_download'] ? $this->in['not_download'] : '');
return $in;
}
示例3: del
/**
* 删除
*/
public function del()
{
$name = $this->in['name'];
if (!$name) {
show_json($this->L["username_can_not_null"], false);
}
if ($name == 'admin') {
show_json($this->L['default_user_can_not_do'], false);
}
if ($this->sql->delete($name)) {
del_dir(USER_PATH . $name . '/');
show_json($this->L['success']);
}
show_json($this->L['error'], false);
}
示例4: fileSave
public function fileSave()
{
$filestr = rawurldecode($this->in['filestr']);
$charset = $this->in['charset'];
$path = _DIR($this->in['path']);
if (!is_writable($path)) {
show_json($this->L['no_permission'], false);
}
if ($charset != '' || $charset != 'utf-8') {
$filestr = mb_convert_encoding($filestr, $this->in['charset'], 'utf-8');
}
$fp = fopen($path, 'wb');
fwrite($fp, $filestr);
fclose($fp);
show_json($this->L['save_success']);
}
示例5: index
public function index()
{
// Server Sent Event
// header('Content-Type: text/event-stream');
header('Content-Type: text/octet-stream');
header('Cache-Control: no-cache');
$t1 = microtime(true);
define('PROJECT_SITE_PATH', C('PROJECT.SITE_PATH') . '/' . $_GET['site']);
define('PROJECT_MODULE_NAME', $_GET['module']);
$path = PROJECT_SITE_PATH . '/' . C('PROJECT.SRC_DIR') . '/' . PROJECT_MODULE_NAME . '/' . C('M3D_FILENAME');
$tool = new PreprocessTool($path);
$tool->run();
mark('处理完成!', 'emphasize');
$t2 = microtime(true);
show_json('编译用时:' . round($t2 - $t1, 2) . 's');
}
示例6: set
/**
* 参数设置
* 可以同时修改多个:key=a,b,c&value=1,2,3
*/
public function set()
{
$key = $this->in['k'];
$value = $this->in['v'];
if ($key != '' && $value != '') {
$conf = $this->config['user'];
$arr_k = explode(',', $key);
$arr_v = explode(',', $value);
$num = count($arr_k);
for ($i = 0; $i < $num; $i++) {
$conf[$arr_k[$i]] = $arr_v[$i];
}
fileCache::save($this->config['user_seting_file'], $conf);
show_json($this->L["setting_success"]);
} else {
show_json($this->L['error'], false);
}
}
示例7: payResult
public function payResult($params)
{
global $_W;
$fee = intval($params['fee']);
$data = array('status' => $params['result'] == 'success' ? 1 : 0);
$ordersn = $params['tid'];
$order = pdo_fetch('select id,ordersn, price,openid,dispatchtype,addressid,carrier,status,isverify,deductcredit2,virtual from ' . tablename('ewei_shop_order') . ' where ordersn=:ordersn and uniacid=:uniacid limit 1', array(':uniacid' => $_W['uniacid'], ':ordersn' => $ordersn));
$orderid = $order['id'];
if ($params['from'] == 'return') {
$address = false;
if (empty($order['dispatchtype'])) {
$address = pdo_fetch('select realname,mobile,address from ' . tablename('ewei_shop_member_address') . ' where id=:id limit 1', array(':id' => $order['addressid']));
}
$carrier = false;
if ($order['dispatchtype'] == 1) {
$carrier = unserialize($order['carrier']);
}
if ($params['type'] == 'cash') {
show_json(2, array('order' => $order, 'address' => $address, 'carrier' => $carrier));
} else {
if ($order['status'] == 0) {
$pv = p('virtual');
if (!empty($order['virtual']) && $pv) {
$pv->pay($order);
} else {
pdo_update('ewei_shop_order', array('status' => 1, 'paytime' => time()), array('id' => $orderid));
if ($order['deductcredit2'] > 0) {
$shopset = m('common')->getSysset('shop');
m('member')->setCredit($order['openid'], 'credit2', -$order['deductcredit2'], array(0, $shopset['name'] . "余额抵扣: {$order['deductcredit2']} 订单号: " . $order['ordersn']));
}
$this->setStocksAndCredits($orderid, 1);
m('notice')->sendOrderMessage($orderid);
if (p('commission')) {
p('commission')->checkOrderPay($order['id']);
}
}
}
show_json(1, array('order' => $order, 'address' => $address, 'carrier' => $carrier, 'virtual' => $order['virtual']));
}
}
}
示例8: _init_data
/**
* 初始化数据 get
* 只传键即可 &ext_not_allow=''&explorer-mkfile&explorer-pathRname
*/
private function _init_data()
{
if (strlen($this->in['role']) < 1) {
show_json($this->L["groupname_can_not_null"], false);
}
if (strlen($this->in['name']) < 1) {
show_json($this->L["groupdesc_can_not_null"], false);
}
$role_arr = array('role' => $this->in['role'], 'name' => $this->in['name']);
$role_arr['ext_not_allow'] = $this->in['ext_not_allow'];
foreach ($this->config['role_setting'] as $key => $actions) {
foreach ($actions as $action) {
$k = $key . ':' . $action;
if (isset($this->in[$k])) {
$role_arr[$k] = 1;
} else {
//$role_arr[$k] = 0;
}
}
}
return $role_arr;
}
示例9: upload_chunk
function upload_chunk($fileInput, $path = './', $temp_path)
{
global $config, $L;
$file = $_FILES[$fileInput];
$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 1;
if (!isset($file)) {
show_json($L['upload_error_null'], false);
}
$file_name = iconv_system($file['name']);
if ($chunks > 1) {
//并发上传,不一定有前后顺序
$temp_file_pre = $temp_path . md5($temp_path . $file_name) . '.part';
if (get_filesize($file['tmp_name']) == 0) {
show_json($L['upload_success'], false, 'chunk_' . $chunk . ' error!');
}
if (move_uploaded_file($file['tmp_name'], $temp_file_pre . $chunk)) {
$done = true;
for ($index = 0; $index < $chunks; $index++) {
if (!file_exists($temp_file_pre . $index)) {
$done = false;
break;
}
}
if (!$done) {
show_json($L['upload_success'], true, 'chunk_' . $chunk . ' success!');
}
$save_path = $path . $file_name;
$out = fopen($save_path, "wb");
if ($done && flock($out, LOCK_EX)) {
for ($index = 0; $index < $chunks; $index++) {
if (!($in = fopen($temp_file_pre . $index, "rb"))) {
break;
}
while ($buff = fread($in, 4096)) {
fwrite($out, $buff);
}
fclose($in);
unlink($temp_file_pre . $index);
}
flock($out, LOCK_UN);
fclose($out);
}
show_json($L['upload_success'], true, iconv_app($save_path));
} else {
show_json($L['move_error'], false);
}
}
//正常上传
$save_path = get_filename_auto($path . $file_name);
//自动重命名
if (move_uploaded_file($file['tmp_name'], $save_path)) {
show_json($L['upload_success'], true, iconv_app($save_path));
} else {
show_json($L['move_error'], false);
}
}
示例10: API_GetGoods
/**
* 获取商品数据
*
* @param array $post POST数据
*/
function API_GetGoods($post)
{
$pagesize = intval($_POST['PageSize']);
$page = intval($_POST['Page']);
if (empty($pagesize)) {
$pagesize = 20;
// 每页大小
}
if ($page < 0) {
$page = 0;
}
//$limit = ' LIMIT ' . ($page * $pagesize) . ', ' . ($pagesize+1);
$today = gmtime();
$is_delete = 0;
$record_count = $GLOBALS['db']->getOne("SELECT count(*) FROM " . $GLOBALS['ecs']->table('goods') . " WHERE is_delete='{$is_delete}' {$where} ");
if ($page > floor($record_count / $pagesize)) {
$page = $record_count / $pagesize;
}
$limit = ' LIMIT ' . $page * $pagesize . ', ' . $pagesize;
$sql = "SELECT goods_id, cat_id, goods_name, goods_sn, brand_id, market_price, shop_price, promote_price, is_on_sale, is_alone_sale, is_best, is_new, is_hot, goods_number, goods_weight, integral, goods_brief, REPLACE(goods_desc, CONCAT(char(170), char(178)), '') AS goods_desc, goods_thumb, goods_img, promote_start_date, promote_end_date, " . " (promote_price > 0 AND promote_start_date <= '{$today}' AND promote_end_date >= '{$today}') AS is_promote, warn_number, keywords, extension_code, seller_note, give_integral " . " FROM " . $GLOBALS['ecs']->table('goods') . " AS g WHERE is_delete='{$is_delete}' {$where} ORDER BY goods_id DESC {$limit}";
$result = array();
$result['Data'] = $GLOBALS['db']->getAll($sql);
$result['NextPage'] = false;
$result['PrevPage'] = false;
$result['RecordCount'] = $record_count;
if ($page < floor($record_count / $pagesize)) {
$result['NextPage'] = true;
}
if ($page > 0) {
$result['PrevPage'] = true;
}
foreach ($result['Data'] as $key => $goods) {
$result['Data'][$key]['is_on_sale'] = $goods['is_on_sale'] == 1;
$result['Data'][$key]['is_alone_sale'] = $goods['is_alone_sale'] == 1;
$result['Data'][$key]['is_best'] = $goods['is_best'] == 1;
$result['Data'][$key]['is_new'] = $goods['is_new'] == 1;
$result['Data'][$key]['is_hot'] = $goods['is_hot'] == 1;
$result['Data'][$key]['is_promote'] = $goods['is_promote'] == 1;
$result['Data'][$key]['goods_desc'] = htmlspecialchars($goods['goods_desc']);
$result['Data'][$key]['keywords'] = htmlspecialchars($goods['keywords']);
$result['Data'][$key]['promote_start_date'] = local_date('Y-m-d', $goods['promote_start_date']);
$result['Data'][$key]['promote_end_date'] = local_date('Y-m-d', $goods['promote_end_date']);
$tmp = array();
if ($goods['goods_thumb'] != '') {
$tmp['Type'] = substr($goods['goods_thumb'], strrpos($goods['goods_thumb'], '.') + 1);
$tmp['Data'] = get_goods_image_url($goods['goods_id'], $goods['goods_thumb'], true);
} else {
$tmp['Type'] = '';
$tmp['Data'] = '';
}
$result['Data'][$key]['goods_thumb'] = $tmp;
if ($goods['goods_img'] != '') {
$tmp['Type'] = substr($goods['goods_img'], strrpos($goods['goods_img'], '.') + 1);
$tmp['Data'] = get_goods_image_url($goods['goods_id'], $goods['goods_img'], false);
} else {
$tmp['Type'] = '';
$tmp['Data'] = '';
}
$result['Data'][$key]['goods_img'] = $tmp;
}
show_json($GLOBALS['json'], $result, true);
}
示例11: save
/**
* save data;
*/
public static function save($file, $data)
{
//10000 need 6s
if (!$file) {
return;
}
if (file_exists($file) && !is_writable($file)) {
show_json('the path "data/" can not write!', false);
}
if ($fp = fopen($file, "w")) {
if (flock($fp, LOCK_EX)) {
// Perform exclusive locking type
$str = CONFIG_EXIT . json_encode($data);
fwrite($fp, $str);
fflush($fp);
// flush output before releasing the lock
flock($fp, LOCK_UN);
// Release the lock
}
fclose($fp);
}
}
示例12: die
<?php
//微赞科技 by QQ:800083075 http://www.012wz.com/
if (!defined('IN_IA')) {
die('Access Denied');
}
global $_W, $_GPC;
$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
$openid = m('user')->getOpenid();
$uniacid = $_W['uniacid'];
$orderid = intval($_GPC['id']);
$order = pdo_fetch("select id,status,isverify,verified,verifycode from " . tablename('ewei_shop_order') . ' where id=:id and uniacid=:uniacid and openid=:openid limit 1', array(':id' => $orderid, ':uniacid' => $uniacid, ':openid' => $openid));
if (empty($order)) {
show_json(0, '订单未找到!');
}
$qrcode = $this->model->createQrcode($orderid);
show_json(1, array('qrcode' => $qrcode, 'verifycode' => $order['verifycode']));
示例13: pdo_update
$status = 2;
}
}
}
if ($status == 2) {
$update['eno'] = $this->model->createENO();
}
} else {
$status = 2;
}
$update['status'] = $status;
pdo_update('ewei_shop_creditshop_log', $update, array('id' => $logid));
if ($status == 2) {
$this->model->sendMessage($logid);
}
show_json($status);
}
}
}
}
$_W['shopshare'] = array('title' => !empty($goods['share_title']) ? $goods['share_title'] : $goods['title'], 'imgUrl' => !empty($goods['share_icon']) ? tomedia($goods['share_icon']) : tomedia($goods['thumb']), 'link' => $this->createPluginMobileUrl('creditshop/detail', array('id' => $id)), 'desc' => !empty($goods['share_desc']) ? $goods['share_desc'] : $goods['title']);
$com = p('commission');
if ($com) {
$cset = $com->getSet();
if (!empty($cset)) {
if ($member['isagent'] == 1 && $member['status'] == 1) {
$_W['shopshare']['link'] = $this->createPluginMobileUrl('creditshop/detail', array('id' => $id, 'mid' => $member['id']));
if (empty($cset['become_reg']) && (empty($member['realname']) || empty($member['mobile']))) {
$trigger = true;
}
} else {
示例14: array
exit;
}
$ps = array();
$ps['tid'] = $log['tid'];
$ps['user'] = $openid;
$ps['fee'] = $log['fee'];
$ps['title'] = $log['title'];
if ($type == 'credit') {
$credits = m('member')->getCredit($openid, 'credit2');
if ($credits < $ps['fee']) {
show_json(0, "余额不足,请充值");
}
$fee = floatval($ps['fee']);
$result = m('member')->setCredit($openid, 'credit2', -$fee, array($_W['member']['uid'], '消费' . $setting['creditbehaviors']['currency'] . ':' . $fee));
if (is_error($result)) {
show_json(0, $result['message']);
}
$record = array();
$record['status'] = '1';
$record['type'] = 'cash';
pdo_update('core_paylog', $record, array('plid' => $log['plid']));
pdo_update('ewei_shop_order', array('paytype' => 1), array('id' => $order['id']));
$ret = array();
$ret['result'] = 'success';
$ret['type'] = $log['type'];
$ret['from'] = 'return';
$ret['tid'] = $log['tid'];
$ret['user'] = $log['openid'];
$ret['fee'] = $log['fee'];
$ret['weid'] = $log['weid'];
$ret['uniacid'] = $log['uniacid'];
示例15: authCheck
/**
* 权限验证;统一入口检验
*/
public function authCheck()
{
if (isset($GLOBALS['is_root']) && $GLOBALS['is_root'] == 1) {
return;
}
if (in_array(ACT, $this->notCheck)) {
return;
}
if (!array_key_exists(ST, $this->config['role_setting'])) {
return;
}
if (!in_array(ACT, $this->config['role_setting'][ST])) {
return;
}
//有权限限制的函数
$key = ST . ':' . ACT;
$group = new fileCache($this->config['system_file']['group']);
$GLOBALS['auth'] = $auth = $group->get($this->user['role']);
//默认扩张功能等价权限
$auth['explorer:pathChmod'] = $auth['explorer:pathRname'];
$auth['explorer:pathCopyDrag'] = $auth['explorer:pathCuteDrag'];
if ($auth[$key] !== 1) {
show_json($this->L['no_permission'], false);
}
//扩展名限制:新建文件&上传文件&重命名文件&保存文件&zip解压文件
$check_arr = array('mkfile' => isset($this->in['path']) ? $this->in['path'] : '', 'pathRname' => isset($this->in['rname_to']) ? $this->in['rname_to'] : '', 'fileUpload' => isset($_FILES['file']['name']) ? $_FILES['file']['name'] : '', 'fileSave' => isset($this->in['path']) ? $this->in['path'] : '');
if (array_key_exists(ACT, $check_arr) && !checkExt($check_arr[ACT])) {
show_json($this->L['no_permission_ext'], false);
}
}