returnJson 동작 방식 일부 수정
This commit is contained in:
+9
-18
@@ -3,22 +3,16 @@ require(__dir__.'/../vendor/autoload.php');
|
||||
|
||||
function SetHeaderNoCache(){
|
||||
if(!headers_sent()) {
|
||||
header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1.
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
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 CustomHeader() {
|
||||
//FIXME: 왜 Contect-Type이 text/html로 고정이지?!
|
||||
if(!headers_sent()) {
|
||||
header('Cache-Control: no-cache');
|
||||
header('Pragma: no-cache');
|
||||
// header('Cache-Control: public');
|
||||
// header('Pragma: public');
|
||||
// header('Content-Type: text/html; charset=utf-8');
|
||||
}
|
||||
//define(CURPATH, 'f_async');
|
||||
//define(FILE, substr(strrchr(__FILE__, "\\"), 1));
|
||||
//xxx: CustomHeader를 제거하기 전까진 유지
|
||||
SetHeaderNoCache();
|
||||
}
|
||||
|
||||
function getmicrotime() {
|
||||
@@ -124,14 +118,11 @@ function delExpiredInDir($dir, $t) {
|
||||
|
||||
|
||||
function returnJson($value, $noCache = true, $pretty = false, $die = true){
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if($noCache){
|
||||
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');
|
||||
SetHeaderNoCache();
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if($pretty){
|
||||
$flag = JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT;
|
||||
|
||||
+12
-6
@@ -9,6 +9,15 @@ 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/
|
||||
@@ -68,14 +77,11 @@ function parseJsonPost(){
|
||||
}
|
||||
|
||||
function returnJson($value, $noCache = true, $pretty = false, $die = true){
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if($noCache){
|
||||
header('Expires: Sun, 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');
|
||||
SetHeaderNoCache();
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if($pretty){
|
||||
$flag = JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT;
|
||||
|
||||
+11
-5
@@ -132,15 +132,21 @@ function Error($message, $url="") {
|
||||
exit;
|
||||
}
|
||||
|
||||
function returnJson($value, $noCache = true, $pretty = false, $die = true){
|
||||
header('Content-Type: application/json');
|
||||
|
||||
if($noCache){
|
||||
header('Expires: Sun, 01 Jan 2014 00:00:00 GMT');
|
||||
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 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;
|
||||
|
||||
Reference in New Issue
Block a user