收入啤酒88 发表于 2017-4-6 08:19:11

php Yii: 出现undefined offset 或者 undefined index解决方案

在开发Yii 时,在程序中定义了如下方式:
       if($this->menuoption === 'test'),那么在运行程序时会报:undefined offset:2,这样的错误主要是由于php.ini 里的错误等级太高了,在windows下错误等级是:error_reporting =  E_ALL & ~E_NOTICE,这样就不会报错。而在Ubuntu系统里面,按照完php5之后,在/etc/php5/apache2/php.ini文件中定义的error_reporting值为:E_ALL & ~E_DEPRECATED。
      要解决此问题需要将error_reporting值设置为:E_ALL & ~E_NOTICE。
页: [1]
查看完整版本: php Yii: 出现undefined offset 或者 undefined index解决方案