add platform: Baidu CFC

pull/128/head
qkqpttgf 2020-08-16 11:40:42 +08:00 committed by GitHub
parent 1f4552bb73
commit eb12b784d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 1 deletions

View File

@ -14,6 +14,10 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
//if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/HuaweiFG_file.php'; //if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/HuaweiFG_file.php';
//else include 'platform/HuaweiFG_env.php'; //else include 'platform/HuaweiFG_env.php';
echo 'FG' . PHP_EOL; echo 'FG' . PHP_EOL;
} elseif ($_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') {
//set_include_path(get_include_path() . PATH_SEPARATOR . '/opt/php');
//include 'BaiduBce.phar';
include 'platform/BaiduCFC.php';
} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') { } elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
include 'platform/Heroku.php'; include 'platform/Heroku.php';
$path = getpath(); $path = getpath();
@ -60,7 +64,7 @@ function main_handler($event, $context)
return main($path); return main($path);
} }
// Aliyun FC & Huawei FG // Aliyun FC & Huawei FG & Baidu CFC
function handler($event, $context) function handler($event, $context)
{ {
if (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') { if (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') {
@ -110,6 +114,26 @@ function handler($event, $context)
return main($path); return main($path);
} elseif ($_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') {
// Baidu CFC
//$html = '<pre>'. json_encode($event, JSON_PRETTY_PRINT).'</pre>';
//$html .= '<pre>'. json_encode($context, JSON_PRETTY_PRINT).'</pre>';
//$html .= '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>';
//$html .= $event['path'];
//$html .= $context['functionBrn'];
//return json_encode(output($html), JSON_FORCE_OBJECT);
printInput($event, $context);
unset($_POST);
unset($_GET);
unset($_COOKIE);
unset($_SERVER);
GetGlobalVariable($event);
//echo '<pre>'. json_encode($_COOKIE, JSON_PRETTY_PRINT).'</pre>';
$path = GetPathSetting($event, $context);
return json_encode(main($path), JSON_FORCE_OBJECT);
} }
} }