autoloader 구성.
class 정의
This commit is contained in:
+2
-30
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
require(__dir__.'/../vendor/autoload.php');
|
||||
require(__dir__.'/../d_setting/conf.php');
|
||||
use utilphp\util as util;
|
||||
|
||||
|
||||
/**
|
||||
* conf.php 파일 생성용 코드
|
||||
@@ -9,15 +9,6 @@ use utilphp\util as util;
|
||||
* 이 파일만 예외적으로 lib.php, func.php를 참조하지 않고 독자적으로 동작함.
|
||||
*/
|
||||
|
||||
function SetHeaderNoCache(){
|
||||
if(!headers_sent()) {
|
||||
header('Expires: Wed, 01 Jan 2014 00:00:00 GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', FALSE);
|
||||
header('Pragma: no-cache');
|
||||
}
|
||||
}
|
||||
|
||||
function parseJsonPost(){
|
||||
// http://thisinterestsme.com/receiving-json-post-data-via-php/
|
||||
// http://thisinterestsme.com/php-json-error-handling/
|
||||
@@ -76,27 +67,8 @@ function parseJsonPost(){
|
||||
return $decoded;
|
||||
}
|
||||
|
||||
function returnJson($value, $noCache = true, $pretty = false, $die = true){
|
||||
if($noCache){
|
||||
SetHeaderNoCache();
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if($pretty){
|
||||
$flag = JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT;
|
||||
}
|
||||
else{
|
||||
$flag = JSON_UNESCAPED_UNICODE;
|
||||
}
|
||||
echo json_encode($value, $flag);
|
||||
if($die){
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
if(file_exist(__dir__.'/d_setting/conf.php')){
|
||||
returnJson([
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'이미 설정 파일이 존재합니다.'
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user