Closed cuteist closed 4 years ago
我尝试将index.php的php script部分修改为
if (preg_match('#\.php.*#', $uri) or preg_match('#/archives.*#', $uri)) { try{ if (preg_match('#/archives.*#', $uri)) { $cgi_params = [ 'HTTP_HOST' => $host, 'SERVER_NAME' => $host, 'SERVER_PORT' => '443', 'REQUEST_URI' => 'index.php'.$uri ]; } else { $cgi_params = ['HTTP_HOST' => $host, 'SERVER_NAME' => $host, 'SERVER_PORT' => '443']; } $resp = $GLOBALS['fcPhpCgiProxy']->requestPhpCgi( $request, $root_dir, "index.php", $cgi_params, ['debug_show_cgi_params' => true, 'readWriteTimeout' => 5000] ); return $resp; } catch (Exception $e){ $GLOBALS['fcPhpCgiProxy'] = new \ServerlessFC\PhpCgiProxy(); $resp = $GLOBALS['fcPhpCgiProxy']->requestPhpCgi( $request, $root_dir, "index.php", ['HTTP_HOST' => $host, 'SERVER_NAME' => $host, 'SERVER_PORT' => '443'], ['debug_show_cgi_params' => true, 'readWriteTimeout' => 5000] ); return $resp; } }
但这样做,当我访问http://example.com/archives/example.html 时,会显式的跳转为http://example.com/index.php/archives/example.html
https://yq.aliyun.com/articles/684764
尝试参考下这个?
或者您这边直接基于函数计算的 custom runtime 实现, https://github.com/awesome-fc/customruntime-php; 跟传统的玩法一样, nginx+php-fpm, 直接在nginx 设置 rewrite即可
膜拜大佬们,都玩出花了
我尝试将index.php的php script部分修改为
但这样做,当我访问http://example.com/archives/example.html 时,会显式的跳转为http://example.com/index.php/archives/example.html