search

Home  >  Q&A  >  body text

How to close mysql error prompt

Like the title, what is the way to close error prompts in the native mysql and pdo classes to avoid error messages being discovered by hackers. Please provide details on how to modify it

按键盘手指磨破皮按键盘手指磨破皮2697 days ago1411

reply all(2)I'll reply

  • 寻觅 beyond

    寻觅 beyond2017-09-23 21:41:48

    <?php
    // 关闭所有PHP错误报告
    error_reporting(0);
    
    // Report simple running errors
    error_reporting(E_ERROR | E_WARNING | E_PARSE);
    
    // 报告 E_NOTICE也挺好 (报告未初始化的变量
    // 或者捕获变量名的错误拼写)
    error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
    
    // 除了 E_NOTICE,报告其他所有错误
    error_reporting(E_ALL ^ E_NOTICE);
    
    // 报告所有 PHP 错误 (参见 changelog)
    error_reporting(E_ALL);
    
    // 报告所有 PHP 错误
    error_reporting(-1);
    
    // 和 error_reporting(E_ALL); 一样
    ini_set('error_reporting', E_ALL);
    ?>

    The scope of action is limited to the current program, other php files will not work. If you want all php files to be executed without errors, just modify the error reporting settings in php.ini

    reply
    0
  • 按键盘手指磨破皮

    I'm asking about mysql error messages, not php ones.

    按键盘手指磨破皮 · 2017-09-24 02:59:39
  • liberty

    liberty2017-09-22 22:42:31

    Using @ annotation will not prompt you


    reply
    0
  • 按键盘手指磨破皮

    This is a stupid way. It is definitely unrealistic to write @ on everything. What I mean is modifying the configuration file or opening a certain method.

    按键盘手指磨破皮 · 2017-09-22 22:44:02
  • Cancelreply