php中预先定义好的常量:
__file__
当前正在处理的脚本文件名。如果使用在一个被包含的文件中,那么它的值就是这个被包含的文件,而不是包含它的文件名。
__line__
正在处理的文件的当前行数。
php_version
表示php处理器的当前版本,如:'3.0.8-dev'。
php_os
php处理器所在的操作系统名字,如:'linux'。
true
真值
false
假值
可以用define函数定义更多的常量。
如,定义常量:
<?php
define("constant", "hello world.");
echo constant; // outputs "hello world."
?>
用 __file__ 和 __line__ 的举例
<?php
function report_error($file, $line, $message) {
echo "an error occured in $file on line $line: $message.";
}
report_error(__file__,__line__, "something went wrong!");
?>
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
网安追踪流程
1.不用代理网民发帖流程:发帖人 → ISP → 服务器托管商 → 服务器网警追踪流程:网监 → 服务器IP →...
[阅读全文]
-
-
-
HTTP状态码大全
转自:https://www.cnblogs.com/lxinxuan/archive/2009/10/22/1...
[阅读全文]
-
-
-
-
网友评论