Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the ecshop debug mode parameter DEBUG_MODE

2025-03-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how to use the ecshop debugging mode parameter DEBUG_MODE, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Find the data/config.php file in the root directory of the ecshop source code, and add:

Define ('DEBUG_MODE', 0)

The parameters are as follows. If you want to configure more than one parameter, write the added value.

0 / / disable debugging

1 / / Show all errors

2 / / disable Smarty caching

4 / / use includes/lib.debug.php

8 / / record the files starting with mysql_query_ from SQL to data directory

To facilitate the development of patterns, display all error messages and disable SMARTY caching.

Define ('DEBUG_MODE', 3); / / 3' 1'2

Description of the principle of each parameter

1) disable debug mode and do not display error messages

If (defined ('DEBUG_MODE') = = false) {define (' DEBUG_MODE', 0);}

The default setting is to turn off error logging and do not log errors, enable smarty caching, and be used in production environments.

2) display all error messages

At the end of the includes/init.php file, find:

If ((DEBUG_MODE & 1) = = 1) {error_reporting (E_ALL);} else {error_reporting (E_ALL ^ (E_NOTICE | E_WARNING));}

If the bit operation is established, all error messages will be enabled. If not, all error messages will be enabled except for E_NOTICE and E_WARNING.

3) disable Smarty caching

In the php files of foreground functions, such as index.php, goods.php, category.php, etc., there are:

If ((DEBUG_MODE & 2)! = 2) {$smarty- > caching = true;}

If the bit operation condition is true, the caching of smarty is turned on.

4) use includes/lib.debug.php to debug

If ((DEBUG_MODE & 4) = = 4) {include (ROOT_PATH. 'includes/lib.debug.php');}

If the bit operation condition is true, the file lib_debug.php is introduced to debug the error message.

5) record the SQL of the query to the specified file

In the includes/cls_mysql.php file query method

If (defined ('DEBUG_MODE') & & (DEBUG_MODE & 8) = = 8) {$logfilename = $this- > root_path. DATA_DIR. '/ mysql_query_'. $this- > dbhash. '_'. Date ('Yimmachid`). '.log'; $str = $sql. "\ n\ n"; if (PHP_VERSION > = '5.0') {file_put_contents ($logfilename, $str, FILE_APPEND);} else {$fp = @ fopen ($logfilename, 'ab+'); if ($fp) {fwrite ($fp, $str); fclose ($fp);}

If the condition is true, the SQL query statement will be appended to the data/ directory, and the log file name is defined by $logfilename.

These are all the contents of the article "how to use the ecshop debug mode parameter DEBUG_MODE". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report