<?php /** * Created by PhpStorm. * User: siyu.wang * Date: 2017/10/10 * Time: 10:42 */ namespace Text; class Person{ public function text(){ echo '当前行是第',__LINE__,'行','<br/>'; // 当前行是第13行 echo __FILE__,'<br/>'; // C:\wamp\www\test\magicConstant.php echo __DIR__,'<br/>'; // C:\wamp\www\test echo __FUNCTION__,'<br/>'; // text echo __CLASS__,'<br/>'; // Text\Person echo __METHOD__,'<br/>'; // 包含类名和方法名 Text\Person::text echo __NAMESPACE__,'<br/>'; // Text } } $aa = new Person(); $aa->text();
常用的魔术常量。
最新推荐文章于 2023-10-09 18:15:49 发布