本文整理汇总了PHP中json_output函数的典型用法代码示例。如果您正苦于以下问题:PHP json_output函数的具体用法?PHP json_output怎么用?PHP json_output使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了json_output函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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]);
}
示例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);
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
示例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);
}
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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.');
}
}
}
示例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);
}
示例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);
}
示例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
}