diff --git a/index.php b/index.php index 98aef13..20af99c 100644 --- a/index.php +++ b/index.php @@ -14,6 +14,10 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') { //if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/HuaweiFG_file.php'; //else include 'platform/HuaweiFG_env.php'; 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') { include 'platform/Heroku.php'; $path = getpath(); @@ -60,7 +64,7 @@ function main_handler($event, $context) return main($path); } -// Aliyun FC & Huawei FG +// Aliyun FC & Huawei FG & Baidu CFC function handler($event, $context) { 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); + } elseif ($_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') { + // Baidu CFC + //$html = '
'. json_encode($event, JSON_PRETTY_PRINT).''; + //$html .= '
'. json_encode($context, JSON_PRETTY_PRINT).''; + //$html .= '
'. json_encode($_SERVER, JSON_PRETTY_PRINT).''; + //$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 '
'. json_encode($_COOKIE, JSON_PRETTY_PRINT).''; + $path = GetPathSetting($event, $context); + + return json_encode(main($path), JSON_FORCE_OBJECT); + } }