PHP code example of weiboad / fierysdk
1. Go to this page and download the library: Download weiboad/fierysdk 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/ */
weiboad / fierysdk example snippets
server{
listen 80;
charset utf-8;
root /path/xxx/xxx/src/public;
server_name xxx.com;
location /{
index index.php index.html index.htm;
if (-f $request_filename) {
break;
}
if (-d $request_filename) {
break;
}
if ($request_filename !~ (\.css|images|index\.php.*) ) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ /index.php/ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
//curl must fill
$digpooint = RagnarSDK::digLogStart(__FILE__, __LINE__, "curl");
//curl init ....
$nextrpcidheader = RagnarSDK::getCurlChildCallParam($digpooint);
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $nextrpcidheader);
$result = //curl exec ...
$ext = array("errorno" => $errno, "error" => curl_error($this->ch));
$info = curl_getinfo($this->ch);
//digCurlEnd($digPoint, $url, $method, $postParam, $getParam, $curlInfo, $errCode, $errMsg, $result)
RagnarSDK::digLogEnd($digpooint, array(
"url" => $info['url'], "method" => self::get_method(),
"param" => array("post" => $this->post_fields, "get" => $this->query_fields),
"info" => $info,
"error" => $ext,
"result" => json_decode($result,true),//must array
);
//this for record the exception when the error
RagnarSDK::RecordLog(\Adinf\RagnarSDK\RagnarSDK::LOG_TYPE_EXCEPTION, __FILE__, __LINE__, "mysql", array("fun" => "query", "sql" => $sql, "error" => $ex->getMessage()));
//start monitor the performance
$digPoint = RagnarSDK::digLogStart(__FILE__, __LINE__, "mysql");
//do some sql execute
//for the mysql performance dig point end
//RagnarSDK::digLogEnd($digPoint, array("sql" => $sql, "data" => "sql的参数", "op" => "select\delete\update\...", "fun" => "execute_sql"));
RagnarSDK::digMysqlEnd($digPoint, $sql, "sql的参数", "select\delete\update\...", "execute_sql");
//if is error
if(error){
RagnarSDK::RecordLog(RagnarConst::LOG_TYPE_EXCEPTION, __FILE__, __LINE__, "mysql", array("fun" => "execute", "sql" => $sql, "error" => $error));
}