PHP code example of jzweb / sdk

1. Go to this page and download the library: Download jzweb/sdk 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/ */

    

jzweb / sdk example snippets



//平台请求配置
$config = array(
        'key' => 'apiKey', //您的应用key
        'prefix' => 'Prefix', //签名前缀
        'secret' => 'Your Secret', //您的应用secret 密钥
        'url' => 'http://www.server.com', //API请求地址
        'debug' => false, //是否启用debug模式
        'headers'=> array(
             'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36',
             'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'               
            )
        );
$client = new \jzweb\sdk\client($config);

//单个参数赋值
$client->api = 'test.api';
$client->user_id = 1000;

//批量赋值
$client->setParams(array('name'=>'yeyupl','email'=>'[email protected]'));

//GET请求
$response = $client->get();

//POST请求
$response = $client->post();

//获得组装GET参数后的URL
echo $client->getUrl();

//获得所有参数
print_r($client->getParams());