网络编程 
首页 > 网络编程 > 浏览文章

不常用但很实用的PHP预定义变量分析

(编辑:jimmy 日期: 2024/5/20 浏览:3 次 )

1. $php_errormsg — 前一个错误信息

<"htmlcode">
<"http://example.com");

 var_dump($http_response_header);

}

get_contents();

var_dump($http_response_header);

"htmlcode">
<"htmlcode">
<"htmlcode">
var_dump(__FILE__); //所在路径文件名和文件名称   E:\demo\blog_code\predefined\predefined.php
var_dump(__DIR__); //所在完整目录         E:\demo\blog_code\predefined
var_dump(__LINE__); //代码所在行号         4
class testClass{
  function testMethod(){
    var_dump(__FUNCTION__); //返回当前方法名  testMethod
    var_dump(__CLASS__);  //返回类名     testClass
    var_dump(__METHOD__);  //类名加方法名   testClass::testMethod
  }
}
 
$a=new testClass();
$a->testMethod();

上一篇:PHP实现的抓取小说网站内容功能示例
下一篇:PHP中define() 与 const定义常量的区别详解