OneManager-php/index.php

55 lines
1.6 KiB
PHP
Raw Normal View History

2019-12-30 06:15:35 -08:00
<?php
2020-01-18 04:12:21 -08:00
include 'vendor/autoload.php';
2019-12-30 06:15:35 -08:00
include 'conststr.php';
2020-01-18 04:12:21 -08:00
include 'function/common.php';
2019-12-30 06:15:35 -08:00
2020-03-04 01:36:29 -08:00
//echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>';
2020-01-18 04:12:21 -08:00
if ($_SERVER['USER']==='qcloud') {
include 'function/scf.php';
} elseif ($_SERVER['HEROKU_APP_DIR']==='/app') {
include 'function/heroku.php';
$path = getpath();
//echo 'path:'. $path;
$_GET = getGET();
//echo '<pre>'. json_encode($_GET, JSON_PRETTY_PRINT).'</pre>';
$re = main($path);
$sendHeaders = array();
foreach ($re['headers'] as $headerName => $headerVal) {
header($headerName . ': ' . $headerVal, true);
}
http_response_code($re['statusCode']);
2020-03-04 20:27:18 -08:00
echo $re['body'];
2020-01-18 04:12:21 -08:00
} else {
include 'function/normal.php';
$path = getpath();
//echo 'path:'. $path;
$_GET = getGET();
//echo '<pre>'. json_encode($_GET, JSON_PRETTY_PRINT).'</pre>';
2019-12-30 06:15:35 -08:00
2020-01-18 04:12:21 -08:00
$re = main($path);
$sendHeaders = array();
foreach ($re['headers'] as $headerName => $headerVal) {
header($headerName . ': ' . $headerVal, true);
2019-12-30 06:15:35 -08:00
}
2020-01-18 04:12:21 -08:00
http_response_code($re['statusCode']);
2020-03-04 20:27:18 -08:00
echo $re['body'];
2020-01-18 04:12:21 -08:00
}
function main_handler($event, $context)
{
$event = json_decode(json_encode($event), true);
$context = json_decode(json_encode($context), true);
printInput($event, $context);
unset($_POST);
unset($_GET);
unset($_COOKIE);
unset($_SERVER);
GetGlobalVariable($event);
2020-01-19 20:49:55 -08:00
//echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>';
2020-01-18 04:12:21 -08:00
$path = GetPathSetting($event, $context);
2020-02-19 19:59:58 -08:00
2020-03-04 20:27:18 -08:00
$re = main($path);
if ($re['isBase64Encoded']) $re['body'] = base64_encode($re['body']);
return $re;
2020-01-18 04:12:21 -08:00
}