PHP code example of liuwave / fc-thinkphp

1. Go to this page and download the library: Download liuwave/fc-thinkphp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

liuwave / fc-thinkphp example snippets




// [ 应用入口文件 ]
namespace think;


)->http;
$app=new App();
$app->setRuntimePath(getenv('PHP_RUNTIME_PATH')?:'/tmp/');
$http = $app->http;

$response = $http->run();

$response->send();

$http->end($response);


function handler($request, $context) : Response
{   
       //设置thinkphp根目录
    $appPath=__DIR__ . '/tp';
    


 [
      'is_cli'       => false,//是否为cli模式,默认为cgi模式
      'ignore_file'  => false,//是否检测请求路径为存在的文件,如果忽略,则交由thinkphp 入库函数处理,默认为false,即若请求路径为文件(php后缀名除外),直接返回文件内容
      'root'         => '/code/tp',//thinkphp项目的root_path
      'runtime_path' => '/tmp/',//缓存目录
      'host' => '',//自定义域名,默认为 HTTP_HOST
    ];


use RingCentral\Psr7\Response;
use liuwave\fc\think\FcThink;

function handler($request, $context) : Response
{
        //设置thinkphp根目录
    $appPath=__DIR__ . '/tp';
    



// [ 应用入口文件 ]
namespace think;


)->http;
$app=new App();
$app->setRuntimePath(getenv('PHP_RUNTIME_PATH')?:'/tmp/');
$http = $app->http;

$response = $http->run();

$response->send();

$http->end($response);


 requestPhpCgi($request, $docRoot, $phpFile = "index.php", $fastCgiParams = [], $options = []);


    /
      test-think
        test-fun
          index.php
      template.yml
ini
#文件 /extension/filesize.ini
upload_max_filesize = 6m