复制内容到剪贴板
代码:
<html>
<head>
<title>PHP预定义常量</title>
</head>
<body>
<center>
<h2>预定义常量的应用</h2>
<?php
function report_error($file,$line,$message){
echo "An error occured in $file on line $line:$message";
}
report_error(__FILE__,__LINE__,"wrong!");
echo "
程序当前行是:".__LINE__;
echo "
操作系统是:".PHP_OS;
echo "
PHP版本是:".PHP_VERSION;
?>
</center>
</body>
<html>复制内容到剪贴板
代码:
<html>
<head>
<title>PHP自定义变量</title>
</head>
<body>
<center>
<h2>自定义变量的应用</h2>
<?php
//自定义常量
define("GREETING","早上好!\n");
echo GREETING."
";
echo constant("GREETING")."
";
//忽略常量的大小写
define("WELCOME","欢迎进入PHP论坛",true);
echo WELCOME."
";
echo welcome."
";
//判断常量是否定义
echo defined("NOT")."
";
define("NOT","现在定义啦!");
//定义了返回1,否则返回空行
echo defined("NOT")."
";
?>
</center>
</body>
<html>大部分我是懂啦。但是有些地方还是不明白。希望前辈能够指出这两段代码重点地方。
[
本帖最后由 离群的猴子 于 2007-11-15 09:03 编辑 ]