PHP code example of tencentcloudbase / tcb-manager-php

1. Go to this page and download the library: Download tencentcloudbase/tcb-manager-php 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/ */

    

tencentcloudbase / tcb-manager-php example snippets




$tcbManager = TcbManager::init([
    "secretId" => "Your SecretId",
    "secretKey" => "Your SecretKey",
    "secretToken" => "Your SecretToken", // 使用临时凭证需要此字段
    "envId" => "Your envId"  // TCB环境ID,可在腾讯云TCB控制台获取
]);

$tcbManager = TcbManager::init([
    "envId" => "Your envId"
]);

$tcbManager = new TcbManager([
    "secretId" => "Your SecretId",
    "secretKey" => "Your SecretKey",
    "secretToken" => "Your SecretToken", // 使用临时凭证需要此字段
    "envId" => "Your envId"  // TCB环境ID,可在腾讯云TCB控制台获取
])



// 使用 composer 时不需要 ../autoload.php -> tcb-manager-php/autoload.php
([
    "secretId" => "Your SecretId",
    "secretToken" => "Your SecretToken", // 使用临时凭证需要此字段
    "envId" => "Your envId"  // TCB环境ID,可在腾讯云TCB控制台获取
]);

// 2. 获得云函数管理示例
$funcManager = $tcbManager->getFunctionManager();

// 3. 调用 getFunction 获取云函数详情
$result = $funcManager->getFunction("hellotcb");

// 4. 打印结果
print_r($result);
bash
   composer