换win7了,装的是phpnow最新的包PHPnow-1.5.5_1版本
apache是2.0版本但是这句php运行出错,我是在本机环境下测试
if($_COOKIE['Yahei20100331']!=null)
header("Location:admin_index.php");提示:
Notice: Undefined index: Yahei20100331 in E:\Web\htdocs\index.php on line 3
这个程序我以前在老机器上测试是没有问题
而且放在购买的美国主机和香港主机上运行也都是正常的。
奇怪了

解决方案 »

  1.   

    Notice 级错误,可以不管他. error_reporting(E_ALL^E_NOTICE);
    应该没拼错吧.
      

  2.   

    不是错误,只是PHP的输出的提示信息,php.ini中的error_reporting参数设置为E_ALL ^ E_NOTICE
    或者在程序中加上
    error_reporting(E_ALL ^ E_NOTICE);
      

  3.   

    PHP5对变量的检查很严格。
    PHP4的时候,这类notice是不显示的。
    你print_r($_COOKIE);一下看看有没有这个:Yahei20100331
    没有,就会报notice。
    可以在php.ini里屏蔽notice,或者用如下代码:
    $name=isset($_COOKIE["Yahei20100331"])?$_COOKIE["Yahei20100331"]:"";
    if($name!="") header("Location:admin_index.php");