欢迎您的来访!有源码,好建站(www.codehy.com)源码海洋源码网为您提供快速建站平台.
当前位置: 首页 > 行业资讯 > php资料 >

老站长告诉你-PHP出现PHPNotice:Useofundefinedconstantxxxxx解决办法

时间:2019-07-19 09:32来源:未知 作者:源码海洋 点击:
老站长告诉你-PHP出现PHPNotice:Useofundefinedconstantxxxxx解决办法 今天我用phpstudy调试程序,总是出现如下问题,但在阿里云服务器上用宝塔面板就没有问题,困扰了我一天的时间,最终百度上找到一篇文章, 试了一下果然有效,分想给大家。 phpstudy2016

老站长告诉你-PHP出现PHPNotice:Useofundefinedconstantxxxxx解决办法

今天我用phpstudy调试程序,总是出现如下问题,但在阿里云服务器上用宝塔面板就没有问题,困扰了我一天的时间,最终百度上找到一篇文章,

试了一下果然有效,分想给大家。

phpstudy2016的log报错信息如下:

[Fri Jul 19 09:27:12.489860 2019] [:error] [pid 12400:tid 1820] [client ::1:4330] PHP Notice:  Use of undefined constant name - assumed 'name' in D:\\phpStudy\\WWW\\tushuguan\\chklogin.php on line 8, referer: http://localhost:90/login.php
[Fri Jul 19 09:27:12.489860 2019] [:error] [pid 12400:tid 1820] [client ::1:4330] PHP Notice:  Use of undefined constant pwd - assumed 'pwd' in D:\\phpStudy\\WWW\\tushuguan\\chklogin.php on line 9, referer: http://localhost:90/login.php

百度后得知这些是 PHP 的提示而非报错,PHP 本身不需要事先声明变量即可直接使用,但是对未声明变量会有提示。一般作为正式的网站会把提示关掉的,甚至连错误信息也被关掉。
修改方法如下:
修改php.ini

error_reporting = E_ALL
改为
error_reporting = E_ALL & ~E_NOTICE

(责任编辑:源码海洋)本文地址:http://www.codehy.com/info/php/2019/0719/19623.html

推荐资讯