개발 Q&A

제목 nicedit json 질문드립니다.
글쓴이 oursong 작성시각 2013/09/28 22:55:40
댓글 : 2 추천 : 0 스크랩 : 0 조회수 : 16597   RSS
자바를 모르다보니 이게 대체 무슨 문젠지 모르겠네요
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class nicUpload extends CI_Controller {

 function __construct()
 {
  parent::__construct();

  $config['upload_path']   = 'http://sawa-c.com/include/images';
  $config['allowed_types'] = 'gif|jpg|png';
  $config['max_size']   = '100';
  $config['max_width']  = '1024';
  $config['max_height'] = '768';

  $this->nicupload_uri = 'http://sawa-c.com/include/images';
  $this->load->library('upload', $config);
  $this->output->enable_profiler(FALSE);
 } 

 public function do_upload()
 {

  if($this->input->server('REQUEST_METHOD') == 'POST') {
   if ( ! $this->upload->do_upload('nicImage')) {
    $data = $this->nic_output(array('error' => $this->upload->display_errors()));
   } else {
    $upload = array('upload_data' => $this->upload->data());

    $status['done']  = 1;
    $status['width'] = $upload['upload_data']['image_width'];
    $status['url']   = $this->nicupload_uri.'/'.$upload['upload_data']['file_name'];

    $data = $this->nic_output($status);
   }
  } else if(isset($_GET['check'])) {
   $status['noprogress'] = true;
   $data = $this->nic_output($status);
  }

  return $this->output->set_output($data);
 }

 private function nic_output($status) {
  $script = 'try {'.(($this->input->server('REQUEST_METHOD') == 'POST') ? 'top.' : '').'nicUploadButton.statusCb('.json_encode($status).');} catch(e) { alert(e.message); }'; 
  if($this->input->server('REQUEST_METHOD') == 'POST') {
   return '<script>'.$script.'</script>';
  } else {
   return $script;
  }
 }
}
문제가 되는건 여기서 44번 라인 그러니까 $script = 'try~~~~~ { alert(e.message); }';라는 부분입니다.
PHP Fatal error:  Call to undefined function json_encode()
라는 에러가 뜨네요. 이미지 업로드 기능인데 이거 어떻게 고쳐서 처리해야 할런지... 도움 좀 부탁드립니다.
태그 망할 json
 다음글 양승현님이 올려주신 JSON 파일 문의 드립니다. (6)
 이전글 elephant.io 쓰려는데요 (1)

댓글

변종원(웅파) / 2013/09/28 23:56:52 / 추천 0
서버 php버전이.낮아서 json_encode 함수가 없는.겁니다. 검색해보시면 json 함수가 없을때 대체하는 방법 나옵니다. ^^
oursong / 2013/09/29 00:03:10 / 추천 0
 감사합니다. 한 번 찾아서 처리해 보겠습니다.