Notice: Undefined variable: P in /807/4VaY/index.php on line 15 Warning: constant(): Couldn't find constant in /807/4VaY/index.php on line 15 0 什么原因
<?php
$p="";
//定义圆周率的两种取值
define("PI1",3.14);
define("PI2",3.142);
//定义值的精度
$height = "中";
//根据精度返回常量名,将常量变成了一个可变的常量
if($height == "中"){
$p = "PI1";
}else if($height == "低"){
$p = "PI2";
}
$r=1;
$area=constant($p)*$r*$r;
echo $area;
?>看看你的p是不是大写了或者写错了。
大概齐是未定义的变量
然后说好的代码呢