??PHP的朋友都知道,其?最?心的就是程序中出?一些?常或??,?些??如果?出到用?的?幕?把用????,甚至?此?了工作,如果不?出到?幕就得想?法??到日?中,但是似乎不是每?人都有查看??日?的??,?了解????尬的??,所以我?了?段代?,其用意就是?我??的php程式出?的?候把???容捕捉出?然後?到我?的email?.
先看效果:
Define('SYS_DEBUG',false);IF(SYS_DEBUG) {ini_set('display_errors','on');Error_reporting(E_ALL);//上?后使用??定Error_reporting(E_ERROR | E_WARNING | E_PARSE);}Else{ini_set('display_errors','off');Error_reporting(0);}//??捕捉Register_shutdown_function('Fun::Error');Class Fun{/**通用出??理参数:要?出的?容,是否?止?行程序?明:有?值??函式可以用??出自定?的???容另外?可以配合Register_shutdown_function??自?抓取???容,??抓取的???容?送到Email?Register_shutdown_function的?制是程序?行完?或中途出???用函?如果是自?抓取???被?用,??取得最後一次出?的?容,如果???有???容?跳出返回:?容?被直接?出至?幕或Email?用法:Fun::Error('???容');Fun::Error('???容',False);/**/Public Static Function Error($M='',$E=True){$ErrTpl='<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body><table cellspacing="0" cellpadding="0" border="0"><tr><td style="padding:5px;background-color:#F57900;font-size:13px;border:1px solid #444;color:#222;">{$M}</td></tr></table>';$M=Trim($M);IF($M!='') {//手工?用$M=' <b>注意:</b> '.$M;Echo Strtr($ErrTpl,Array('{$M}'=>$M));unSet($ErrTpl);IF($E===True) {Die();}Return ;}Else{//程式?行完?自?抓取????用$M=error_get_last();//取得最後?生的??IF(!Is_array($M) Or Count($M)<4) {Unset($M);Return ;}IF(!File_Exists($M['file'])) {Unset($M);Return ;}//取得5行出???代?,如果取不到?容,?明出??案不存在$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) ? '<b>'.(($M['line']-3)+($i+1)).'</b>' : (($M['line']-3)+($i+1));$E['M'].=': '.Htmlspecialchars($E[$i],ENT_QUOTES,'UTF-8').'<br>';}$E=&$E['M'];$M='<b>自?捕捉到有???生!</b><br><br><b>??描述:</b><br> <b>'.$M['file'].'</b>的第<b>'.$M['line'].'</b>行出?了?型?<b>'.$M['type'].'</b>的??:<br> '.$M['message'].'<br><br><b>??代?:</b><br>'.$E.'<br>'.self::now('Y-m-d H:i:s',time()).'<br>';$M=Strtr($ErrTpl,Array('{$M}'=>$M));unSet($ErrTpl);$G=seft::getG('SYS','config');IF(!self::Mail2($G['Spe'],'警告: '.$G['Tit'].' 出? PHP 程式??!',$M) And SYS_DEBUG===True){throw new Exception('警告: '.$G['Tit'].' 出? PHP 程式??!<br><br>'.$M);}IF(SYS_DEBUG) {Echo $M;}unSet($E,$M,$G);Die();}}/**发送??参数:收件人,?件??(不可有?行符),?件?容(行?行之?必?用\n分隔,每行不可超?70?字符)?明:?用PHP?置函式Mail?送??返回:返回布?值用法:$IsSend=Fun::Mail2($email,$tit,$msg);/**/Public Static Function Mail2($to,$tit,$msg) {IF(Filter_var($to,FILTER_VALIDATE_EMAIL)==''){throw new Exception('??地址??!');}$tit='=?UTF-8?B?'.Base64_Encode($tit).'?=';$msg = str_replace("\n.","\n..",$msg); //Windows如果在一行开头发现一个句号则会被删掉,要避免此问题将单个句号替换成两个句号Return Mail($to,$tit,$msg,'From:'.seft::getG('config/SYS/Mal')."\n".'Content-Type:text/html;charset=utf-8');}}

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version
Recommended: Win version, supports code prompts!

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Chinese version
Chinese version, very easy to use
