PHP Learning Notes (ii)

Source: Internet
Author: User

PHP Log
(1) using echo, simple output
(2) using Print_r (), can have a regular printing complex structure
(3) Var_dump recursive output of some structure
(4) print (), Simple printing
You can put the error content you want to output in the above statement or function to print output, you can also write to a file as your log log: file_put_contents ('/test1.txt ', $value [' Value '],file_append) And so on such a file function
The above is my own work in the summary of the PHP debugging method, very useful.
Remove Eclipse Warning
Add a sentence to the line where the error occurred.
@SuppressWarnings ("Unchecked")
Contains only one time

Require_once (' cmd_php4/command.php ');

Log errors
  • Trigger_error ("Cannot find $path", e_user_error);
  • Using variables outside of the function

    Global $mytext;
    $mytext = "Nihao";
    function Chao_echo () {
    echo $GLOBALS [' mytext '];
    }
    Chao_echo ()

    In PHP, there are three ways to refer to variables outside the function in a function:

    1. Outside the function global declaration, the function uses the $globals array reference.

    2. function within the global declaration, function within the $globals array or direct reference.

    3. A parameter is passed when the function is called.

    How do div align vertically?

    PHP Learning Notes (ii)

    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.