Using PHP? Capture PHP original? ?? And? Email notification ?? All PHP friends know about it? Most? What is in the program? Some? Common or ??,? Some ?? If? Used? ? Screen? Use ????, Even? Here? After work, if not? Outgoing? You have to think about the screen? Method ?? To date? But it does not seem like every? Check all users ?? ? ??,? Understand ???? Deleted ??, So me? ? Segment Generation ?, What does it mean? Me ?? ? ? Waiting ??? Can capture? Then? To me? Email ?.
First look at the effect:
Define ('sys _ debug', false); IF (SYS_DEBUG) {ini_set ('display _ errors ', 'on'); Error_reporting (E_ALL); // on? After using ?? Set Error_reporting (E_ERROR | E_WARNING | E_PARSE);} Else {ini_set ('display _ errors ', 'off'); Error_reporting (0 );}//?? Capture Register_shutdown_function ('fun: error'); Class Fun {/** Universal output ?? Parameter: Yes? Outgoing? Rong, OK? Stop? Row program? Ming: Yes? Value ?? Functions can be used ?? Self-determined? ??? What else? Can be used with Register_shutdown_function ?? ? Capture ??? Rong ,?? Captured ??? Rong? Sent to Email? What about Register_shutdown_function? Is it a program? ? Or midway out ??? Letter of use? If it is from? Capture ??? By? Yes ,?? Get the Last Exit? ? Rong, if ??? Yes ??? Rong? Bounce return :? Rong? Directly? Outbound? Screen or Email? Usage: Fun: Error ('??? Rong '); Fun: Error ('??? Rong ', False);/**/Public Static Function Error ($ M = '', $ E = True) {$ ErrTpl ='
'; $ M = Trim ($ M); IF ($ M! = '') {// Manual? Use $ M ='
Note:'. $ M; Echo Strtr ($ ErrTpl, Array ('{$ M}' => $ M); unSet ($ ErrTpl); IF ($ E = True) {Die ();} Return;} Else {// program? ? ? Capture ???? Use $ M = error_get_last (); // get the last? Born ?? IF (! Is_array ($ M) Or Count ($ M) <4) {Unset ($ M); Return;} IF (! File_Exists ($ M ['file']) {Unset ($ M); Return;} // Get 5 rows out ??? Generation ?, If not? Rong ,? ?? Case does not exist $ E = Array_slice (File ($ M ['file']), ($ M ['line']-4), 5); IF (! Is_array ($ E) {Unset ($ M, $ E); Return ;}$ E ['M'] = ''; For ($ I = 0; $ I <5; $ I ++) {$ E [$ I] = isSet ($ E [$ I])? $ E [$ I]: ''; $ E ['M']. =''; $ E ['M']. = ($ I = 3 )? '
'. ($ M ['line']-3) + ($ I + 1 )).'': ($ M ['line']-3) + ($ I + 1); $ E ['M']. = ':'. htmlspecialchars ($ E [$ I], ENT_QUOTES, 'utf-8 ').'
';} $ E = & $ E ['M']; $ M ='
? Captured ??? Born!?? Description:'. $ M ['file'].'The
'. $ M ['line'].'Outbound? ? Type?
'. $ M ['type'].'?? :
'. $ M ['message'].'
?? Generation? :'. $ E .'
'. Self: now ('Y-m-d H: I: S', time ()).'
'; $ M = Strtr ($ ErrTpl, Array (' {$ M} '=> $ M); unSet ($ ErrTpl); $ G = seft :: getG ('sys ', 'config'); IF (! Self: Mail2 ($ G ['SP'], 'warning:'. $ G ['tit']. 'output? PHP program ??! ', $ M) And SYS_DEBUG = True) {throw new Exception ('Warning:'. $ G ['tit']. 'output? PHP program ??!
'. $ M) ;}if (SYS_DEBUG) {Echo $ M;} unSet ($ E, $ M, $ G); Die () ;}}/** send ?? Parameter: recipient ,? ?? (Not available? Line character ),? ? Capacity (row? ? Required? Separated by \ n, each line cannot exceed? 70? Character )? Ming :? PHP? Set the Mail function? Send ?? Return: return cloth? Value usage: $ IsSend = Fun: Mail2 ($ email, $ tit, $ msg);/**/Public Static Function Mail2 ($ to, $ tit, $ msg) {IF (Filter_var ($ to, FILTER_VALIDATE_EMAIL) = '') {throw new Exception ('?? Address ??! ') ;}$ Tit =' =? UTF-8? B? '. Base64_Encode ($ tit ).'? = '; $ Msg = str_replace ("\ n. "," \ n .. ", $ msg); // if a period is found at the beginning of a line in Windows, it will be deleted. to avoid this problem, replace a period with two periods: Return Mail ($, $ tit, $ msg, 'From :'. seft: getG ('config/SYS/Mal '). "\ n ". 'content-Type: text/html; charset = utf-8 ');}}