README_ZH.md 926 字节
Newer Older
S
songzhian 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
# PHP SkyWalking 类: SkyWalking PHP 客户端 


---

- [安装](#installation)
- [要求](#requirements)
- [快速开始实例](#quick-start-and-examples)

---

### Installation

使用安装 SkyWalking 类, 操作:


### Requirements

PHP Curl Class works with PHP 5.2 - 7.9.99 , and HHVM.

### Quick Start and Examples
    
    // must put these code at the beginning !!!
    // that would auto register shutdown function !!!
    
    include_once ("./sdk-php/SkyWalking.php");// or use composer
    
    //LOG_PATH is skywalking's logfile path
    SkyWalking::getInstance("api")->setLogPath(LOG_PATH)->setSamplingRate(5);
    
    ....
    ....

    $ch = curl_init();
    curl_setopt($ch);
    
    ....
    ....

    SkyWalking::getInstance()->startSpanOfCurl("www.api.com", $headers);
    
    ....
    ....
    
    curl_setopt($ch);
    $rs = curl_exec($ch);
    
    SkyWalking::getInstance()->endSpanOfcurl($ch);
    
    ....
    ....