国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ??? ?? PHP ???? A PHP log class for debuging

A PHP log class for debuging

Jun 23, 2016 pm 01:30 PM

分享一個(gè)我自己用的在 WordPress 開(kāi)發(fā)中用得到的一個(gè)調(diào)試日志類(lèi)。

<?php/** * @author: suifengtec coolwp.com * @date:   2013-02-03 09:55:55 * @last Modified by:   suifengtec coolwp.com * @last Modified time: 2015-07-12 18:40:02 */if(function_exists('add_action')){    defined('ABSPATH') or exit;}if(!class_exists('CoolWP_com_Log')){    final class CoolWP_com_Log{        private $dir = null;        private $debug_file_name = null;        private $f_path = null;        public function __clone() {            _doing_it_wrong( __FUNCTION__, 'Cheatin&#8217; huh?', '0.9.0' );        }        public function __wakeup() {            _doing_it_wrong( __FUNCTION__, 'Cheatin&#8217; huh?', '0.9.0' );        }        public function __construct($main_file=''){            $main_file = (''==$main_file)?__FILE__:$main_file;            $this->dir = dirname($main_file).DIRECTORY_SEPARATOR.'debug'.DIRECTORY_SEPARATOR;            $file_name = 'debug_'.md5($main_file).'.log';            $this->debug_file_name = (function_exists('apply_filters'))?apply_filters('cwp_debug_log_file_name',$file_name).'.log':$file_name.'.log';            $this->f_path = $this->dir.$this->debug_file_name;            $this->check_log_file();         }        /**         * adding log item         * @param string $text : adding content         */        public function  add($text) {            date_default_timezone_set('Asia/Shanghai');            if(is_array($text)||is_obeject($text)){                $text = json_encode($text);            }            $fp = fopen( $this->f_path,"a");            flock($fp, LOCK_EX) ;            fwrite($fp,"".date("Y-m-d H:i:s",time())."\n".$text."\n\n");            flock($fp, LOCK_UN);            fclose($fp);            //return true;            //        }        /**         * checking the log file and path.         * @return null         */        private function check_log_file(){            $is_dir = is_dir($this->dir);            $is_file = file_exists($this->f_path);            if($is_dir && $is_file) return;            if(!$is_dir||!$is_file){                if(!$is_dir){                    $md = mkdir($this->dir,0777,true);                }                if(!$is_file){                    $fp = fopen( $this->f_path,"a");                      fclose($fp);                 }            }        }    }/*//CLASS*/}/*ALL DONE.*/?>

以 WordPress 插件為例的用例:
在插件主文件的適當(dāng)位置加入(假如上述代碼放置在class-coolwp-debug-log.php文件中):

$this->is_debug = true;if($this->is_debug){    require_once( plugin_dir_path(__FILE__).'classes/class-coolwp-debug-log.php');    $this->Log = new CoolWP_com_Log();}

如果在插件主文件中將__FILE__定義為常量 SOMEONE_THIS,那么,可以將SOMEONE_THIS 作為參數(shù)傳給CoolWP_com_Log(),例如:

$this->Log = new CoolWP_com_Log(SOMEONE_THIS);

傳不傳參數(shù)的區(qū)別是日志文件的位置不同,如果不傳參數(shù),日志文件位于class-coolwp-debug-log.php所在目錄下的debug目錄下;如果傳遞了SOMEONE_THIS參數(shù),那么,日志文件位于插件主目錄下的debug目錄下。日志文件的文件名稱(chēng)為debug_*******log。

日志條目默認(rèn)采用北京時(shí)間。

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1601
29
PHP ????
1502
276
???
PHP ?? ??? ??????? PHP ?? ??? ??????? Jul 17, 2025 am 04:16 AM

PHP ?? ??? ?? ???? ?? ? ????? ??? ?????. 1. ?? ??? ??? ??? ??? ? ? ??? ??? ??? ?? ?? ??? ???? ???????. 2. ?? ??? ???? ???? ? ?? ????? ?? ?? ?? ??? ?????. 3. $ _get ? $ _post? ?? Hyperglobal ??? ?? ???? ?? ??? ? ??? ??? ??????? ???????. 4. ?? ?? ?? ???? ?? ?? ?? ??? ?????? ?? ??? ??? ?? ??? ???????. ??? ??? ????? ??? ??? ?? ???? ????? ? ??? ? ? ????.

PHP?? ?? ???? ???? ???? ??? ?????? PHP?? ?? ???? ???? ???? ??? ?????? Jul 08, 2025 am 02:37 AM

PHP ?? ???? ???? ????? ?? ? ??? ???? ?? ?? ? ??? ???? ?? ??? ?????? ??? ??? ? ? ???????. 1. ??? ?? CSRF? ???? ?? ??? ??? ???? ?????? ??? ???? FINFO_FILE? ?? ?? MIME ??? ?????. 2. ??? ??? ??? ???? ??? ?? ??? ?? ? WEB ????? ??? ???? ??????. 3. PHP ?? ??? ?? ? ?? ???? NGINX/APACHE? ??? ????? ?? ???? ?????. 4. GD ?????? ??? ? ?? ???? ??? ?? ??? ?? ????.

PHP?? ?? ?? PHP?? ?? ?? Jul 18, 2025 am 04:57 AM

PHP ?? ???? ? ?? ???? ??? ????. 1. // ?? #? ???? ? ?? ??? ???? // ???? ?? ????. 2. ?? /.../ ?? ?? ?? ??? ????? ?? ? ?? ??? ?? ? ? ????. 3. ?? ?? ?? / if () {} /? ?? ?? ??? ????? ??? ?? ?? ?? ??? ???? ????? ???? ??? ?? ???? ???? ??? ? ??? ??????.

PHP?? ???? ??? ?????? PHP?? ???? ??? ?????? Jul 11, 2025 am 03:12 AM

Ageneratorinphpisamemory- ???? Way-Erate-Overgedatasetsetsbaluesoneatimeatimeatimeatimallatonce.1.generatorsuseTheyieldKeywordTocroadtOpvaluesondemand, RetingMemoryUsage.2

PHP ?? ?? ? PHP ?? ?? ? Jul 18, 2025 am 04:51 AM

PHP ??? ???? ??? ??? ??? ????? ????. ??? ????? ?? ???? ??? "?? ? ?"??? "?"? ???????. 1. ??? ? ??? ??? DocBlock (/*/)? ?? ?? ??? ???? ??? ? ?? ???? ??????. 2. JS ??? ???? ?? ???? ??? ?? ??? ??? ?????. 3. ??? ?? ?? ?? ??? ???? ????? ????? ???? ?? ????? ???? ? ??????. 4. Todo ? Fixme? ????? ???? ? ? ??? ??? ???? ?? ?? ? ??? ???????. ??? ???? ?? ??? ??? ?? ?? ?? ???? ???? ? ????.

?? PHP : ??? ??? ?? PHP : ??? ??? Jul 18, 2025 am 04:54 AM

tolearnpheffectical, startBysetTupaloCalserErverEnmentUsingToolslikexamppandacodeeditor -likevscode.1) installxamppforapache, mysql, andphp.2) useacodeeditorforsyntaxsupport.3)) 3) testimplephpfile.next, withpluclucincludechlucincluclucludechluclucled

PHP?? ??? ? ???? ??? ????? ?? PHP?? ??? ? ???? ??? ????? ?? Jul 12, 2025 am 03:15 AM

PHP??? ???? ??? ?? ?? ????? ???? ??? ?? ??? ??? ?? ? ??? ??? ???? ?????. ???? 0?? ???? ?? ??? ???? ? ?? ???? ?? ?? ? ? ????. MB_SUBSTR? ?? ??? ??? ???????. ? : $ str = "hello"; echo $ str [0]; ?? H; ??? MB_SUBSTR ($ str, 1,1)? ?? ??? ??? ??? ??????. ?? ???????? ???? ??? ???? ?? ???? ?? ?? ???? ?????? ??? ????? ?? ??? ?? ??? ???? ???? ?? ????.

?? PHP ?? ??? ?? PHP ?? ??? Jul 18, 2025 am 04:52 AM

toinstallphpquickly, usexampponwindowsorhomebrewonmacos.1. ??, downloadandinstallxAmpp, selectComponents, startApache ? placefilesinhtdocs.2

See all articles