Update index.php

pull/73/head
qkqpttgf 2020-06-04 13:36:21 +08:00 committed by GitHub
parent 093dc63786
commit 7e422a250e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 7 deletions

View File

@ -1,30 +1,30 @@
<?php <?php
//error_reporting(E_ALL & ~E_NOTICE); error_reporting(E_ALL & ~E_NOTICE);
include 'vendor/autoload.php'; include 'vendor/autoload.php';
include 'conststr.php'; include 'conststr.php';
include 'common.php'; include 'common.php';
//echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>';
if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') { if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
include 'platform/tencentscf.php'; include 'platform/TencentSCF.php';
} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
include 'platform/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']);
echo $re['body'];
} elseif (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') { } elseif (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') {
//echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>'; //echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>';
include 'platform/alifc.php'; include 'platform/AliyunFC.php';
} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
include 'platform/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']);
echo $re['body'];
} else { } else {
include 'platform/normal.php'; include 'platform/Normal.php';
$path = getpath(); $path = getpath();
//echo 'path:'. $path; //echo 'path:'. $path;
$_GET = getGET(); $_GET = getGET();
@ -39,6 +39,7 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
echo $re['body']; echo $re['body'];
} }
// Tencent SCF
function main_handler($event, $context) function main_handler($event, $context)
{ {
$event = json_decode(json_encode($event), true); $event = json_decode(json_encode($event), true);
@ -55,6 +56,7 @@ function main_handler($event, $context)
return main($path); return main($path);
} }
// Aliyun FC
function handler($request, $context) function handler($request, $context)
{ {
set_error_handler("myErrorHandler"); set_error_handler("myErrorHandler");
@ -81,6 +83,7 @@ function handler($request, $context)
return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], $re['body']); return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], $re['body']);
} }
// used by Aliyun FC
function myErrorHandler($errno, $errstr, $errfile, $errline) { function myErrorHandler($errno, $errstr, $errfile, $errline) {
if (!(error_reporting() & $errno)) { if (!(error_reporting() & $errno)) {
return false; return false;