Skip to content

Commit

Permalink
add: remote console;optimization: builder phar
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanyanwow committed Jul 8, 2021
1 parent 882871e commit 0ae1df4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
2 changes: 2 additions & 0 deletions builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Time: 17:15
*/

unlink("./siam.phar");

//产生一个siam.phar文件
$phar = new Phar('siam.phar', 0, 'siam.phar');
// 添加src里面的所有文件到siam.phar归档文件
Expand Down
Binary file modified siam.phar
Binary file not shown.
29 changes: 24 additions & 5 deletions src/siam/Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ public static function function_path($funcname)
{
try {
if(is_array($funcname)) {
$func = new ReflectionMethod($funcname[0], $funcname[1]);
$func = new \ReflectionMethod($funcname[0], $funcname[1]);
$funcname = $funcname[1];
} else {
$func = new ReflectionFunction($funcname);
$func = new \ReflectionFunction($funcname);
}
} catch (ReflectionException $e) {
} catch (\ReflectionException $e) {
echo $e->getMessage();
return;
}
Expand All @@ -32,7 +32,7 @@ public static function function_path($funcname)

public static function class_path()
{
$reflector = new ReflectionClass("Child");
$reflector = new \ReflectionClass("Child");
$fn = $reflector->getFileName();
return $fn;
}
Expand Down Expand Up @@ -112,7 +112,7 @@ public static function getRangeTime($start, $end, $dec = 6)
*/
public static function getUseTime($dec = 6)
{
return number_format((microtime(true) - THINK_START_TIME), $dec);
return number_format((microtime(true) - START_MEM), $dec);
}

/**
Expand Down Expand Up @@ -197,4 +197,23 @@ public static function getMemPeak($start, $end, $dec = 2)

return round($size, $dec) . " " . $a[$pos];
}

/**
* 远程日志 服务器运行信息传输
*/
public static function register_remote_console($notify_url){
register_shutdown_function(function() use($notify_url){
$error = error_get_last();
if (empty($error)){
$data = [
'get' => $_GET,
'post' => $_POST,
'session' => $_SESSION,
'server' => $_SERVER,
'inclued_files' => Debug::get_included_files(),
];
$res = Curl::getInstance()->send($notify_url, $data);
}
});
}
}

0 comments on commit 0ae1df4

Please sign in to comment.