当前位置: 首页>>代码示例>>PHP>>正文


PHP JSON::ArrayGetjson方法代码示例

本文整理汇总了PHP中JSON::ArrayGetjson方法的典型用法代码示例。如果您正苦于以下问题:PHP JSON::ArrayGetjson方法的具体用法?PHP JSON::ArrayGetjson怎么用?PHP JSON::ArrayGetjson使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JSON的用法示例。


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

示例1: checklogin

function checklogin()
{
    $login = new Login();
    $json = new JSON();
    if (!$login->check($_POST['sid'])) {
        $code = '200';
        $data_array[0] = array('result' => 'login first');
        $json_string = $json->ArrayGetjson($data_array, $code);
        echo $json_string;
        die;
    }
    return true;
}
开发者ID:caidongyun,项目名称:CS,代码行数:13,代码来源:topicpost.php

示例2: getip

    }
    $sql = "INSERT INTO `" . DB_PRE . "count_install_app` (`uip`, `time`, `hardtype`) VALUES ('" . $uip . "', '" . $time . "', '" . $hardtypein . "');";
    $result = $db->query($sql);
    if ($result) {
        $code = 200;
        $end = 'count succ';
    } else {
        $code = 500;
        $end = 'count failed';
    }
} else {
    $code = 404;
    $end = 'unknown error';
}
if (!empty($code) && !empty($end)) {
    $json_string = $json->ArrayGetjson(array(array('result' => $end)), $code);
    echo $json_string;
}
//获取ip
function getip()
{
    if (!empty($_SERVER["HTTP_CLIENT_IP"])) {
        $cip = $_SERVER["HTTP_CLIENT_IP"];
    } else {
        if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
            $cip = $_SERVER["HTTP_X_FORWARDED_FOR"];
        } else {
            if (!empty($_SERVER["REMOTE_ADDR"])) {
                $cip = $_SERVER["REMOTE_ADDR"];
            } else {
                $cip = "";
开发者ID:caidongyun,项目名称:CS,代码行数:31,代码来源:advice.php

示例3: Topic

            $str = 'ORDER BY lastpost desc';
            break;
    }
    return $str;
}
if ($type == '') {
    echo 'param error';
    exit;
}
//实例化类
$topic = new Topic();
$db = new DB();
$json = new JSON();
$order_array = array('second1', 'second2', 'second3', 'second4', 'second5', 'second6', 'index2', 'index4', 'index5', 'third1', 'third2', 'third3', 'third4', 'third5', 'third6', 'thread_list', 'top_thread', 'digest_thread');
if ($type == 'top_name_list') {
    echo $json->ArrayGetjson($name_array, '200');
    exit;
}
if ($type == 'thread_detail' && $addtype == 'only_owner') {
    $authorid_sql = $topic->getSql('owner_authorid');
    $owner_info = $db->fetch_all($authorid_sql);
    $authorid = $owner_info[0]['authorid'];
    $_GET['authorid'] = $authorid;
}
if ($type == 'thread_detail') {
    $sql = $topic->getSql('thread_detail_getpid', $pageno, $pagesize, '', $addtype);
} else {
    $sql = $topic->getSql($type, $pageno, $pagesize, '', $addtype);
}
if (in_array($type, $order_array)) {
    switch ($type) {
开发者ID:caidongyun,项目名称:CS,代码行数:31,代码来源:topiclist.php

示例4: DB

<?php

require_once './class/db.class.php';
require_once './class/json.class.php';
if (UCDBON == 1) {
    require_once 'dbuc.class.php';
}
$db = new DB();
$json = new JSON();
//存储ios设备device token的接口API
$len = strlen($_POST['token']);
if ($len == 64) {
    $sql = "INSERT INTO `" . DB_PRE . "common_devicetoken` (`token`) VALUES('" . $_POST['token'] . "')";
    $result = $db->query($sql);
    if ($result) {
        $code = '200';
        $data_array[0] = array('result' => 'token save succ');
    } else {
        $code = '200';
        $data_array[0] = array('result' => 'token save failed');
    }
} else {
    $code = '200';
    $data_array[0] = array('result' => 'input token error');
}
$json_string = $json->ArrayGetjson($data_array, $code);
echo $json_string;
开发者ID:caidongyun,项目名称:CS,代码行数:27,代码来源:devicetoken.php

示例5: doLogin

 function doLogin($acc = '', $pw = '')
 {
     $dbl = new DB();
     $json = new JSON();
     if (strtoupper(DBCHARSET) == 'GBK') {
         $acc = mb_convert_encoding($acc, 'GBK', 'UTF-8');
     }
     //查用户名
     if (UCDBON == 1) {
         $db = new DBUC();
         $sql = "SELECT uid,username,password,salt FROM `" . UC_PRE . "members` WHERE username = '" . $acc . "'";
         $pwcheck = $db->fetch_all($sql);
     } else {
         $sql = "SELECT uid,username,password,salt FROM `" . UC_PRE . "members` WHERE username = '" . $acc . "'";
         $pwcheck = $dbl->fetch_all($sql);
     }
     //判断是否是GBK编码的数据库
     if (strtoupper($dbcharset) == 'GBK') {
         if (!empty($pwcheck[0])) {
             foreach ($pwcheck[0] as $k => $v) {
                 $pwcheck[0][$k] = mb_convert_encoding($v, 'GBK', 'UTF-8');
             }
         }
     }
     if (!empty($pwcheck)) {
         if (md5($pw . $pwcheck[0]['salt']) == $pwcheck[0]['password']) {
             //查是否登陆过
             $sql = "SELECT sid FROM `" . DB_PRE . "common_session_app` WHERE uid = '" . $pwcheck[0]['uid'] . "'";
             $sescheck = $dbl->fetch_all($sql);
             if (empty($sescheck)) {
                 //设置sid
                 $sql = "INSERT INTO `" . DB_PRE . "common_session_app` (`sid`, `ip`, `uid`, `username`, `lastlogin`) VALUES ('" . md5($pwcheck[0]['password'] . time()) . "', '" . $_SERVER['REMOTE_ADDR'] . "', '" . $pwcheck[0]['uid'] . "', '" . $pwcheck[0]['username'] . "', '" . time() . "');";
                 $sesset = $dbl->query($sql);
                 if ($sesset) {
                     $sid = md5($pwcheck[0]['password'] . time());
                 } else {
                     $sid = 500;
                 }
             } else {
                 //更新最近登陆时间
                 $sql = "UPDATE `" . DB_PRE . "common_session_app` SET `lastlogin` = '" . time() . "' WHERE `sid` = '" . $sescheck[0]['sid'] . "'";
                 $upsid = $dbl->query($sql);
                 if ($upsid) {
                     $sid = $sescheck[0]['sid'];
                 } else {
                     $sid = 500;
                 }
             }
         } else {
             $sid = 'aperror';
         }
     } else {
         $sid = 'aperror';
     }
     //输出json
     if (empty($sid)) {
         $code = '404';
         $data_array = array();
     } else {
         if (!empty($sid)) {
             $code = '200';
             $data_array[0] = array('sessionid' => $sid, 'uid' => $pwcheck[0]['uid'], 'groupid' => $pwcheck[0]['groupid']);
         } elseif ($sid == 500) {
             $code = '500';
             $data_array = array();
         }
     }
     $json_string = $json->ArrayGetjson($data_array, $code);
     echo $json_string;
 }
开发者ID:caidongyun,项目名称:CS,代码行数:70,代码来源:login.class.php


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