Notice: Undefined variable 的解决方法

这是PHP警告信息,是由于未定义变量引起的。

比如:你未设置变量,却在php中用echo $varstr 了,就会出显这种情况,

解决方法:

修改php.ini

将: error_reporting = E_ALL

修改为:error_reporting = E_ALL & ~E_NOTICE

如果什么错误都不想让显示,直接修改:

display_errors = Off

如果你没有php.ini的修改权限,可在php头部加入

ini_set(“error_reporting”,”E_ALL & ~E_NOTICE”);

即可