Maison > base de données > tutoriel mysql > le corps du texte

用mysql做站点时怎样记录未知错误的发生_MySQL

WBOY
Libérer: 2016-06-01 14:04:36
original
741 Les gens l'ont consulté
 

当使用MySQL做站点的时候,肯定会有不知道的错误发生,怎么记录呢?以下是具体解决方法:

 

<ccid_code></ccid_code>class.method

    //建立错误日志
    function error(){
        $fp=@fopen("error.dat","a+");
        $time=date("Y-m-d H:i:s");
        $msg="{VisitedTime:$time}\t
{VisiterIP:<span class="a14c" id="zoom"> 
<p style="TEXT-INDENT: 2em">当使用MySQL做站点的时候,肯定会有不知道的错误发生,怎么记录呢?以下是具体解决方法: </p>
<p style="TEXT-INDENT: 2em"> </p>
<ccid_nobr></ccid_nobr>
<table cellspacing="0" bordercolordark="#ffffff" cellpadding="2" width="400" align="center" bordercolorlight="#000000" border="1">
    <tbody>
        <tr>
            <td class="code" style="FONT-SIZE: 9pt" bgcolor="#e6e6e6">
            <div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">___FCKpd___0
Copier après la connexion
Copier après la connexion
Copier après la connexion

上面的代码是我使用的一个类中的错误记录方法。

在您的使用了MySQL连接的页面内这样调用。

下面的代码直接在你的目录下建立错误日志。

 

<ccid_code></ccid_code>if(MySQL_error()){
       $classname->error();
}

________________________
Copier après la connexion

 

如果你的页面发生错误,在页面内只要你屏蔽够隐蔽,就不会泄露信息,相对在这个目录内就建立了

error.dat内容为(eg.)

 

<ccid_code></ccid_code>{VisitedTime:2002-05-09 14:43:56}    
{VisiterIP:127.0.0.1}    
{Errormsg:Duplicate entry '0' for key 1}    
{File:->/path/path/errorfilename.PHP}    
{User:sports98}
Copier après la connexion

 

这样的记录对于分析页面肯定是有好处的。

 

如果您是 include请不要加__LINE__

如果您是 require 建议加入__LINE__ 这样更好的帮您迅速找到错误所在位置,以方便解决问题。

SERVER[REMOTE_ADDR]}\t {Errormsg:".MySQL_error()."}\t {File:-> 

当使用MySQL做站点的时候,肯定会有不知道的错误发生,怎么记录呢?以下是具体解决方法:

 

___FCKpd___0
Copier après la connexion
Copier après la connexion

上面的代码是我使用的一个类中的错误记录方法。

在您的使用了MySQL连接的页面内这样调用。

下面的代码直接在你的目录下建立错误日志。

 

___FCKpd___1
Copier après la connexion
Copier après la connexion
Copier après la connexion

 

如果你的页面发生错误,在页面内只要你屏蔽够隐蔽,就不会泄露信息,相对在这个目录内就建立了

error.dat内容为(eg.)

 

___FCKpd___2
Copier après la connexion
Copier après la connexion
Copier après la connexion

 

这样的记录对于分析页面肯定是有好处的。

 

如果您是 include请不要加__LINE__

如果您是 require 建议加入__LINE__ 这样更好的帮您迅速找到错误所在位置,以方便解决问题。

SERVER[PHP_SELF]}\t {User: 

当使用MySQL做站点的时候,肯定会有不知道的错误发生,怎么记录呢?以下是具体解决方法:

 

___FCKpd___0
Copier après la connexion
Copier après la connexion

上面的代码是我使用的一个类中的错误记录方法。

在您的使用了MySQL连接的页面内这样调用。

下面的代码直接在你的目录下建立错误日志。

 

___FCKpd___1
Copier après la connexion
Copier après la connexion
Copier après la connexion

 

如果你的页面发生错误,在页面内只要你屏蔽够隐蔽,就不会泄露信息,相对在这个目录内就建立了

error.dat内容为(eg.)

 

___FCKpd___2
Copier après la connexion
Copier après la connexion
Copier après la connexion

 

这样的记录对于分析页面肯定是有好处的。

 

如果您是 include请不要加__LINE__

如果您是 require 建议加入__LINE__ 这样更好的帮您迅速找到错误所在位置,以方便解决问题。

SESSION[user]}\r\n"; @fputs($fp,$msg); @fclose($fp); }

上面的代码是我使用的一个类中的错误记录方法。

在您的使用了MySQL连接的页面内这样调用。

下面的代码直接在你的目录下建立错误日志。

 

___FCKpd___1
Copier après la connexion
Copier après la connexion
Copier après la connexion

 

如果你的页面发生错误,在页面内只要你屏蔽够隐蔽,就不会泄露信息,相对在这个目录内就建立了

error.dat内容为(eg.)

 

___FCKpd___2
Copier après la connexion
Copier après la connexion
Copier après la connexion

 

这样的记录对于分析页面肯定是有好处的。

 

如果您是 include请不要加__LINE__

如果您是 require 建议加入__LINE__ 这样更好的帮您迅速找到错误所在位置,以方便解决问题。

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!