本文整理汇总了PHP中json_output函数的典型用法代码示例。如果您正苦于以下问题:PHP json_output函数的具体用法?PHP json_output怎么用?PHP json_output使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了json_output函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: image
public function image()
{
$upload_directory = 'public/upload/image/' . date("Y") . '/' . date("m");
$upload_path = $this->config->item('upload_path') . $upload_directory;
if (!is_dir($upload_path)) {
$oldmask = umask(0);
mkdir($upload_path, 0777, TRUE);
umask($oldmask);
}
$file_name = $this->session->user->name . '_' . time() . '.png';
$config['upload_path'] = $upload_path;
$config['file_name'] = $file_name;
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
$field_name = "imageInput";
$output['csrf'] = true;
if (!$this->upload->do_upload($field_name)) {
$output['state'] = false;
$output['error'] = array('upload' => $this->upload->display_errors("", ""), 'data' => $this->upload->data());
} else {
$output['state'] = true;
$avatar = '/' . $upload_directory . '/' . $file_name;
$output['success'] = array('url' => $avatar);
}
json_output($output);
}
开发者ID:luckybirdme,项目名称:CodeIgniter-forum,代码行数:29,代码来源:Upload.php
示例2: load_chat
public function load_chat($idx = 0)
{
$idx = intval($idx);
$this->load->model('main_model', 'main');
$chat = $this->main->load_chat($idx);
$this->main->logged_in_update();
$online_users = $this->main->online_users();
json_output([$chat, $online_users]);
}
开发者ID:idkwim,项目名称:wargamekr,代码行数:9,代码来源:main.php
示例3: join_action
public function join_action()
{
$member = $this->input->post(NULL);
$result = $this->user_model->join_member($member);
if ($result === true) {
json_output([true]);
} else {
json_output($result);
}
}
开发者ID:idkwim,项目名称:wargamekr,代码行数:10,代码来源:user.php
示例4: ajaxGetManager
public function ajaxGetManager()
{
$data = array('PAGE' => !$this->input->post('page') ? 1 : $this->input->post('page'), 'LIMIT' => !$this->input->post('rows') ? 20 : $this->input->post('rows'));
$dataArray = $this->Manager_data->selectManagers($data);
$managerRows = $dataArray['DATA'];
$total_count = $dataArray['TOTAL_COUNT'];
$response = array();
$response['page'] = $data['PAGE'];
$response['total'] = ceil($total_count / $data['LIMIT']);
$response['records'] = $total_count;
$response['rows'] = $managerRows;
json_output($response, true);
}
开发者ID:letmefly,项目名称:tools_script,代码行数:13,代码来源:manager.php
示例5: logout
public function logout()
{
$method = $_SERVER['REQUEST_METHOD'];
if ($method != 'POST') {
json_output(400, array('status' => 400, 'message' => 'Bad request.'));
} else {
$check_auth_client = $this->MyModel->check_auth_client();
if ($check_auth_client == true) {
$response = $this->MyModel->logout();
json_output($response['status'], $response);
}
}
}
开发者ID:moemoe89,项目名称:simple-codeigniter-rest-api,代码行数:13,代码来源:Auth.php
示例6: ajaxGetCharactersOfUserData
function ajaxGetCharactersOfUserData($user_id)
{
$data = array('USER_ID' => $user_id, 'PAGE' => !$this->input->post('page') ? 1 : $this->input->post('page'), 'LIMIT' => !$this->input->post('rows') ? 20 : $this->input->post('rows'));
$dataArray = $this->Character_data->getCharacterRows($data);
$characterRows = $dataArray['DATA'];
$total_count = $dataArray['TOTAL_COUNT'];
$response = array();
$response['page'] = $data['PAGE'];
$response['total'] = ceil($total_count / $data['LIMIT']);
$response['records'] = $total_count;
$response['rows'] = $characterRows;
json_output($response, true);
}
开发者ID:letmefly,项目名称:tools_script,代码行数:13,代码来源:character.php
示例7: login_check
public function login_check($function_array)
{
$function_name = $this->uri->segment(2, null);
if (in_array($function_name, $function_array)) {
if (!$this->session->user) {
$url = base_url('/user/login');
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
$output['redirect'] = $url;
json_output($output);
} else {
redirect($url);
}
}
}
}
开发者ID:luckybirdme,项目名称:CodeIgniter-forum,代码行数:15,代码来源:MY_Controller.php
示例8: ajaxGetMessage
function ajaxGetMessage()
{
$data = array('PAGE' => !$this->input->post('page') ? 1 : $this->input->post('page'), 'LIMIT' => !$this->input->post('rows') ? 20 : $this->input->post('rows'));
$dataArray = $this->Push_data->selectPushMessageRows($data);
$pushRows = $dataArray['DATA'];
$total_count = $dataArray['TOTAL_COUNT'];
$response = array();
$response['page'] = $data['PAGE'];
$response['total'] = ceil($total_count / $data['LIMIT']);
$response['records'] = $total_count;
foreach ($pushRows as $row) {
$response['rows'][] = $row;
}
json_output($response, true);
}
开发者ID:letmefly,项目名称:tools_script,代码行数:15,代码来源:push.php
示例9: ajaxGetFindUserData
function ajaxGetFindUserData()
{
$data = array('PAGE' => !$this->input->post('page') ? 1 : $this->input->post('page'), 'LIMIT' => !$this->input->post('rows') ? 20 : $this->input->post('rows'));
$dataArray = $this->Find_data->getUserRows($data);
$paymentRows = $dataArray['DATA'];
$total_count = $dataArray['TOTAL_COUNT'];
$response = array();
$response['page'] = $data['PAGE'];
$response['total'] = ceil($total_count / $data['LIMIT']);
$response['records'] = $total_count;
foreach ($paymentRows as $index => $row) {
$response['rows'][$index]['id'] = $row['ITEM_CODE'] . '.' . $row['CREATE_DATE'];
$response['rows'][$index]['cell'] = array($is_used == 1 ? $item_name_array[$row['ITEM_CODE']] : $diamond_log_type_array[$row['TYPE']], $row['DIAMOND'], $row['CURRENT_DIAMOND'], $row['CREATE_DATE']);
}
json_output($response, true);
}
开发者ID:letmefly,项目名称:tools_script,代码行数:16,代码来源:find.php
示例10: ajaxGetBannerOfUserData
function ajaxGetBannerOfUserData($user_id)
{
$data = array('USER_ID' => $user_id, 'TABLE_MONTH' => $this->input->post('year_month'), 'PAGE' => !$this->input->post('page') ? 1 : $this->input->post('page'), 'LIMIT' => !$this->input->post('rows') ? 20 : $this->input->post('rows'));
$dataArray = $this->Log_data->getBannerOfUserRows($data);
$paymentRows = $dataArray['DATA'];
$total_count = $dataArray['TOTAL_COUNT'];
$response = array();
$response['page'] = $data['PAGE'];
$response['total'] = ceil($total_count / $data['LIMIT']);
$response['records'] = $total_count;
foreach ($paymentRows as $index => $row) {
$response['rows'][$index]['id'] = $row['GAME_CODE'];
$response['rows'][$index]['cell'] = array('모두의 게임', $row['STATE'] == 0 ? '클릭만' : '보상지급', $row['CLICK_DATE'], $row['PAY_DATE']);
}
json_output($response, true);
}
开发者ID:letmefly,项目名称:tools_script,代码行数:16,代码来源:banner.php
示例11: ajaxGetReceiveGiftOfUserData
function ajaxGetReceiveGiftOfUserData($user_id)
{
$data = array('USER_ID' => $user_id, 'TABLE_MONTH' => $this->input->post('year_month'), 'PAGE' => !$this->input->post('page') ? 1 : $this->input->post('page'), 'LIMIT' => !$this->input->post('rows') ? 20 : $this->input->post('rows'));
$dataArray = $this->Log_data->getReceiveGiftOfUserRows($data);
$giftRows = $dataArray['DATA'];
$total_count = $dataArray['TOTAL_COUNT'];
$response = array();
$response['page'] = $data['PAGE'];
$response['total'] = ceil($total_count / $data['LIMIT']);
$response['records'] = $total_count;
foreach ($giftRows as $index => $row) {
$response['rows'][$index]['id'] = $row['NO'];
$response['rows'][$index]['cell'] = array($row['NO'], '<a href="' . site_url(array('user', 'view', $row['SEND_ID'])) . '" target="_blank">' . $row['SEND_ID'] . '</a>', $row['SEND_DATE'], $row['RECEIVE_DATE']);
}
json_output($response, true);
}
开发者ID:letmefly,项目名称:tools_script,代码行数:16,代码来源:gift.php
示例12: auth
public function auth()
{
$users_id = $this->input->get_request_header('User-ID', TRUE);
$token = $this->input->get_request_header('Authorization', TRUE);
$q = $this->db->select('expired_at')->from('users_authentication')->where('users_id', $users_id)->where('token', $token)->get()->row();
if ($q == "") {
return json_output(401, array('status' => 401, 'message' => 'Unauthorized.'));
} else {
if ($q->expired_at < date('Y-m-d H:i:s')) {
return json_output(401, array('status' => 401, 'message' => 'Your session has been expired.'));
} else {
$updated_at = date('Y-m-d H:i:s');
$expired_at = date("Y-m-d H:i:s", strtotime('+12 hours'));
$this->db->where('users_id', $users_id)->where('token', $token)->update('users_authentication', array('expired_at' => $expired_at, 'updated_at' => $updated_at));
return array('status' => 200, 'message' => 'Authorized.');
}
}
}
开发者ID:moemoe89,项目名称:simple-codeigniter-rest-api,代码行数:18,代码来源:MyModel.php
示例13: ajaxGetDiamondOfUserData
function ajaxGetDiamondOfUserData($user_id, $is_used = 0)
{
$this->load->config('solipop');
$item_name_array = $this->config->item('item_name');
$diamond_log_type_array = $this->config->item('diamond_log_type');
$data = array('USER_ID' => $user_id, 'TABLE_MONTH' => $this->input->post('year_month'), 'IS_USED' => $is_used, 'PAGE' => !$this->input->post('page') ? 1 : $this->input->post('page'), 'LIMIT' => !$this->input->post('rows') ? 20 : $this->input->post('rows'));
$dataArray = $this->Log_data->getDiamondOfUserRows($data);
$paymentRows = $dataArray['DATA'];
$total_count = $dataArray['TOTAL_COUNT'];
$response = array();
$response['page'] = $data['PAGE'];
$response['total'] = ceil($total_count / $data['LIMIT']);
$response['records'] = $total_count;
foreach ($paymentRows as $index => $row) {
$response['rows'][$index]['id'] = $row['ITEM_CODE'] . '.' . $row['CREATE_DATE'];
$response['rows'][$index]['cell'] = array($is_used == 1 ? $item_name_array[$row['ITEM_CODE']] : $diamond_log_type_array[$row['TYPE']], $row['DIAMOND'], $row['CURRENT_DIAMOND'], $row['CREATE_DATE']);
}
json_output($response, true);
}
开发者ID:letmefly,项目名称:tools_script,代码行数:19,代码来源:diamond.php
示例14: createPost
public function createPost()
{
$this->load->model('Category_model');
$this->load->library('form_validation');
$this->form_validation->set_rules('name', 'Name', 'required');
$output = array('state' => false);
if ($this->form_validation->run() == FALSE) {
$output['error'] = form_error_array();
$output['csrf'] = true;
} else {
$output['state'] = true;
$name = $this->input->post('name', TRUE);
$category = array('name' => $name, 'count' => 0);
$id = $this->Category_model->insert($category);
$url = base_url('/category/create');
$output['redirect'] = $url;
}
json_output($output);
}
开发者ID:luckybirdme,项目名称:CodeIgniter-forum,代码行数:19,代码来源:Category.php
示例15: save_customerwork
function save_customerwork()
{
//cmd/save_customerwork.html
$customerdata = get_session('customerdata');
//customer data
if (!$customerdata) {
//not login
json_output('requireLogin');
return '';
}
//history
preg_match('#[^-]+$#', $_POST['history'], $r);
//final result
$history = array('customer_id' => $customerdata->id, 'company' => $_POST['company'], 'salary' => $_POST['sal'], 'save_history' => $_POST['history'], 'result' => $r[0], 'post_date' => date("Y-m-d"), 'post_time' => date('H:i:s a'), 'loan' => preg_replace('#\\.#', '', $_POST['loan']), 'note' => 'Mục đích sử dụng:' . PHP_EOL . $_POST['usedfor'] . PHP_EOL . ',Thời gian chúng tôi liên hệ:' . $_POST['contacttime']);
if (isset($_POST['modify'])) {
//update history
do_update($history, array('id' => $_POST['modify']), 'vcn_histories');
$hid = $_POST['modify'];
} else {
do_insert($history, 'vcn_histories');
$hid = mysql_insert_id();
//history id
}
//update histories1 that save answer text
$history_text = array();
//multi rows
$historyt = json_decode($_POST['historyt']);
//decode answers_text
foreach ($historyt as $answer_id => $text) {
$history_t = array('answer_id' => $answer_id, 'answer_text' => $text, 'hid' => $hid);
$history_text[] = $history_t;
if (isset($_POST['modify'])) {
//update single answer text
do_update($history_t, array('hid' => $_POST['modify']), 'vcn_histories1');
}
}
if (!isset($_POST['modify'])) {
do_insert($history_text, 'vcn_histories1');
}
json_output($hid);
//return new history
}
开发者ID:hoangsoft90,项目名称:multichoice-quiz-logic,代码行数:42,代码来源:ajax.php
示例16: ajaxGetFriendCountOfClassTypeData
function ajaxGetFriendCountOfClassTypeData()
{
$data = array('STAT_TYPE' => 6, 'START_DATE' => $this->input->post('start_date'), 'END_DATE' => $this->input->post('end_date'));
$dataArray = $this->Log_data->getStatsDailyDepthRows($data);
$statRows = $dataArray['DATA'];
$total_count = $dataArray['TOTAL_COUNT'];
$response = array();
$response['page'] = 1;
$response['total'] = 1;
$response['records'] = $total_count;
foreach ($statRows as $date => $rows) {
$data = array('STAT_DATE' => $date, 'TOTAL_COUNT' => 0);
ksort($rows);
foreach ($rows as $class_type => $user_count) {
if (!isset($data['FRIEND_COUNT_' . $class_type])) {
$data['FRIEND_COUNT_' . $class_type] = 0;
}
$data['FRIEND_COUNT_' . $class_type] += $user_count;
$data['TOTAL_COUNT'] += $user_count;
}
$response['rows'][] = $data;
}
json_output($response, true);
}
开发者ID:letmefly,项目名称:tools_script,代码行数:24,代码来源:social.php
示例17: op_addclient
function op_addclient()
{
$arr['domain'] = $_POST['adddomain'];
$pattern = "/([\\w]+\\.[\\w]+)/i";
if (!preg_match($pattern, $arr['domain'])) {
$msg = array('s' => 400, 'm' => lang('invaliddomain'), 'd' => '');
exit(json_output($msg));
}
include_once "ClientModel.class.php";
$clientModel = new ClientModel();
if ($row = $clientModel->getClientByName($arr['domain'])) {
$msg = array('s' => 400, 'm' => lang('domainexist'), 'd' => '');
exit(json_output($msg));
}
$arr['key'] = $clientModel->generateKey();
$r = $clientModel->addNewClient($arr);
if ($r) {
$msg = array('s' => 200, 'm' => lang('success'), 'd' => $GLOBALS['gSiteInfo']['www_site_url'] . "/admin.php/client/defaults");
exit(json_output($msg));
} else {
$msg = array('s' => 400, 'm' => lang('failed'), 'd' => '');
exit(json_output($msg));
}
}
开发者ID:AlvarodelRosal,项目名称:xppass,代码行数:24,代码来源:client.class.php
示例18: array
}
} else {
$api_status_code = 403;
$api_status_txt = $api_upload->error;
}
} else {
$api_status_code = 403;
$api_status_txt = $error;
}
$REST_API = array('status_code' => $api_status_code, 'status_txt' => $api_status_txt, 'data' => $api_data_array);
$OUTPUT_REST_API = array_filter($REST_API);
switch ($format) {
default:
case 'json':
default:
json_output($OUTPUT_REST_API, $callback);
break;
case 'xml':
xml_output($OUTPUT_REST_API);
break;
case 'txt':
echo $api_txt_output;
break;
case 'redirect':
if ($OUTPUT_REST_API['status_code'] == 200) {
$redirect_url = __CHV_BASE_URL__ . __CHV_VIRTUALFOLDER_IMAGE__ . '/' . $api_upload->image_info['image_id_public'];
header("Location: {$redirect_url}");
} else {
die($OUTPUT_REST_API['status_txt']);
}
break;
开发者ID:JJaicmkmy,项目名称:Chevereto,代码行数:31,代码来源:api.php
示例19: json_prepare
/**
* json_prepare
* Hide the display errors and blocks the non XMLHttpRequest
*/
function json_prepare()
{
error_reporting(0);
@ini_set('display_errors', false);
$http_referer = isset($_SERVER['HTTP_REFERER']) ? parse_url($_SERVER['HTTP_REFERER']) : NULL;
if ($_SERVER['HTTP_X_REQUESTED_WITH'] !== 'XMLHttpRequest' && !preg_match('/' . HTTP_HOST . '/', $http_referer['host']) && !preg_match('/127\\.0\\.0\\.1/', $_SERVER['SERVER_ADDR'])) {
die(json_output(array('status_code' => 400, 'status_txt' => 'bad request')));
}
}
开发者ID:JJaicmkmy,项目名称:Chevereto,代码行数:13,代码来源:functions.php
示例20: operation_fail
operation_fail("登陆失败");
}
$weixinAPI = new WeixinAPI();
$json = $weixinAPI->getOpenid($code);
session_start();
// 记录用户信息
$_SESSION['openid'] = $json['openid'];
$_SESSION['access_token'] = $json;
$openid = $json['openid'];
$home_url = '../index.php';
$account = Account::getAccount($json['openid']);
if ($account != null) {
$_SESSION['account'] = $account;
$extra = AccountExtra::getInfo($json['openid']);
if ($extra != null) {
$_SESSION['account_extra'] = $extra;
}
} else {
$weixinAPI = new WeixinAPI();
$userInfo = $weixinAPI->getUserInfo($json['access_token'], $openid);
Account::createAccount($openid, $userInfo['nickname']);
$account = Account::getAccount($json['openid']);
$_SESSION['account'] = $account;
}
//$home_url = '../h5/publish_task_page.php';
header('Location: ' . $home_url);
json_put("session", $_SESSION['access_token']);
json_output();
?>
开发者ID:QingkaiLi,项目名称:task,代码行数:29,代码来源:login_callback.php
注:本文中的json_output函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论