-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstdR.php
38 lines (38 loc) · 994 Bytes
/
stdR.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/*stdR.php*/
define("EMPTY", 0);
define("SUCCESS",1);
define("CONTENT_PLAIN", 20);
define("CONTENT_JSON", 21);
function generateStandardResponse($status_code,$contents="",$contentType=CONTENT_PLAIN){
if($contents==""){$contentType="";}
$tmp=array(
"stc"=>$status_code,
"c"=>$contents,
"ct"=>$contentType
);
return $tmp;
}
function convertSRtoString($SRArray){
$tmp="{";
$tmp.=$SRArray['stc'];
$tmp.=",";
$tmp.=$SRArray['c'];
$tmp.=",";
$tmp.=$SRArray['ct'];
$tmp.="}";
return $tmp;
}
function addBreak() {
echo "<br>";
}
function doEcho($status_code,$contents = "",$contentType=CONTENT_PLAIN){
if($contents=="" and !is_numeric($contents)){$contentType="";}
echo "{";
echo $status_code;
echo chr(44);
echo $contents;
echo chr(44);
echo "$contentType}";
}
?>