PHP magic constant _ PHP Tutorial

Source: Internet
Author: User
PHP magic constant .? Php ************ note part of the magic constant 1: Unable to manually modify his value, so called constant 2: But the value changes with the environment, so it's called Magic --- magic constant _ FILE _ return /****
****/


/***
=== Note ====
Magic constant

1: The value cannot be manually modified, so it is called a constant.
2: But the value changes with the environment, so it is called Magic

--- Magic constant
_ FILE _ return the path of the current FILE.
Used to calculate the root directory of a website in framework development or website initialization scripts

_ LINE _ returns the current row number.
In the framework, it can be used to record error information during debugging.



_ CLASS _ returns the current CLASS name

_ METHOD _ returns the current METHOD name.
***/


Echo 'the currently running is ',__ FILE __, 'file ','
';

Echo 'current in ',__ DIR __,' Directory
';

Echo 'Hi, I am at ',__ LINE __,'
';
Echo 'hello, I am at ',__ LINE __,'
';
Echo 'Hehe, I am at ',__ LINE __,'
';


Class Human {
Public static function t (){
Echo 'You are running ',__ CLASS __,' CLASS
';
Echo ',__ METHOD __, 'method ';
}
}

Human: t ();

Http://www.bkjia.com/PHPjc/477907.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/477907.htmlTechArticle? Php/******** // ***** === Note ==== Magic constant 1: Unable to manually modify his value, so it is called constant 2: But the value changes with the environment, so it is called Magic --- magic constant _ FILE _ to return...

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.