From 3685224d6a968233d0ba70bc43f6fcd170b7b8c3 Mon Sep 17 00:00:00 2001 From: augushong Date: Wed, 1 Dec 2021 16:24:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96xdebug=E5=87=BD=E6=95=B0,?= =?UTF-8?q?=E4=BB=A5=E5=85=BC=E5=AE=B9=E6=9B=B4=E9=AB=98=E7=89=88=E6=9C=AC?= =?UTF-8?q?php;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/common.php b/app/common.php index f9564b0..b9d9e9f 100644 --- a/app/common.php +++ b/app/common.php @@ -55,7 +55,21 @@ if (!function_exists('xdebug')) { $file = is_null($suffix) ? runtime_path() . 'xdebug/' . date('Ymd') . '.txt' : runtime_path() . 'xdebug/' . date('Ymd') . "_{$suffix}" . '.txt'; } file_put_contents($file, "[" . date('Y-m-d H:i:s') . "] " . "========================= {$type} ===========================" . PHP_EOL, FILE_APPEND); - $str = (is_string($data) ? $data : (is_array($data) || is_object($data)) ? print_r($data, true) : var_export($data, true)) . PHP_EOL; + + $str = ''; + + if(is_string($data)){ + $str = $data; + }else{ + if(is_array($data) || is_object($data)){ + $str = print_r($data, true); + }else{ + $str = var_export($data, true); + } + } + + $str . PHP_EOL; + $force ? file_put_contents($file, $str) : file_put_contents($file, $str, FILE_APPEND); } }