青风百里

PHP 魔术常量
看个代码<?php class Student{ public function showInfo...
扫描右侧二维码阅读全文
28
2018/09

PHP 魔术常量

  • 看个代码
<?php

class Student{
    public function showInfo(){
        echo "当前行号:".__LINE__;
        echo "<br>";
        echo "当前文件:".__FILE__;
        echo "<br>";
        echo "当前目录:".__DIR__;
        echo "<br>";
        echo "当前类名:".__CLASS__;
        echo "<br>";
        echo "当前函数名:".__FUNCTION__;
        echo "<br>";
        echo "当前方法名:".__METHOD__;
        echo "<br>";
        echo "当前命名空间:".__NAMESPACE__;
    }
}

$stuObj = new Student();
$stuObj->showInfo();

Last modification:September 28th, 2018 at 05:30 pm

Leave a Comment