Ecshop debugging statement writing

Source: Internet
Author: User

We often use it when debugging in ecshop.

Var_dump ($ Val );

Die ();

To output and view the variables. However, when there are too many variables, the display will be incomplete. At this time, we will consider using print_r


Print_r ($ Val );

Die ();

However, the output content is not neat, so we want to format it and modify it:


Echo "<PRE> ";

Print_r ($ Val );

Echo "</PRE> ";

Die ();

In this way, we can view all the variables, but we don't want to write so much trouble every time, so we can encapsulate our own print Variable Function dump_die ()


Function dump_die ($ Val)

{

Echo "<PRE> ";

Print_r ($ Val );

Echo "</PRE> ";

Die ();

}


We can use this function to check the variables in the future. The problem is where this function is stored. Do we write this function into the file for debugging every time, we still introduce the file for writing this function during every debugging. In fact, there is a position in ecshop to write the global function, that is, mongodes/init. PHP file, which is the file initialized by ecshop. If we put the function here, we can directly call our print function anywhere.


Ecshop debugging statement writing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.