PHP magic constant

Source: Internet
Author: User
PHP magic constant & lt ;? Php & nbsp; ***** & nbsp; & nbsp; public welfare PHP Lecture Hall & nbsp; altar: & nbsp; www. zixue. it & nbsp; Micro & nbsp; blog: & nbsp; weibo. comyshba & nbsp; YY Channel: & nbsp; 8835 PHP magic constant
  1. /****
  2. Yan 18 public welfare PHP Lecture Hall
  3. Discussion: http://www.zixue.it
  4. Micro Bo: http://weibo.com/Yshiba
  5. YY Channel: 88354001
  6. ****/
  7. /***
  8. === Note ====
  9. Magic constant
  10. 1: The value cannot be manually modified, so it is called a constant.
  11. 2: But the value changes with the environment, so it is called Magic
  12. --- Magic constant
  13. _ FILE _ return the path of the current FILE.
  14. Used to calculate the root directory of a website in framework development or website initialization scripts
  15. _ LINE _ returns the current row number.
  16. In the framework, it can be used to record error information during debugging.
  17. _ CLASS _ returns the current CLASS name
  18. _ METHOD _ returns the current METHOD name.
  19. ***/
  20. Echo 'the currently running is ',__ FILE __, 'file ','
    ';
  21. Echo 'current in ',__ DIR __,' Directory
    ';
  22. Echo 'Hi, I am at ',__ LINE __,'
    ';
  23. Echo 'hello, I am at ',__ LINE __,'
    ';
  24. Echo 'Hehe, I am at ',__ LINE __,'
    ';
  25. Class Human {
  26. Public static function t (){
  27. Echo 'You are running ',__ CLASS __,' CLASS
    ';
  28. Echo ',__ METHOD __, 'method ';
  29. }
  30. }
  31. Human: t ();

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.