PHP注意:class-gd-system-plugin-config.PHP中未定义偏移量
我收到这个信息: PHP注意:未定义的偏移量:1英寸 /第56行的home/printet1/public_html/wp content/mu plugins/gd system plugin/class-gd-system-plugin-config.php 有关守则如下:PHP注意:class-gd-system-plugin-config.PHP中未定义偏移量,php,undefined,Php,Undefined,我收到这个信息: PHP注意:未定义的偏移量:1英寸 /第56行的home/printet1/public_html/wp content/mu plugins/gd system plugin/class-gd-system-plugin-config.php 有关守则如下: public function get_config( ) { if ( empty( $this->config ) ) { $defaults = $this->_get_config( '/w
public function get_config( ) {
if ( empty( $this->config ) ) {
$defaults = $this->_get_config( '/web/conf/gd-wordpress.conf' );
$resellers = $this->_get_config( '/web/conf/gd-resellers.conf' );
$reseller = null;
if ( defined( 'GD_RESELLER' ) && is_numeric( GD_RESELLER ) ) {
$reseller = $resellers[GD_RESELLER];
}
if ( is_array( $reseller ) && !empty( $reseller ) ) {
$this->config = array_merge( $defaults, $reseller );
} else {
$this->config = $defaults;
}
}
return $this->config;
}
第56行具体为:
$RELESER=$RELESER[GD_RELESER]
我对编码比较陌生,希望获得关于如何解决此问题的任何信息/帮助。我已经阅读了关于哪里出了问题的解释,但不明白如何解决这个问题
提前感谢您的帮助 看来$Distrillers数组没有您想要的值。 调试的一种方法是添加
var_dump(GD_RESELLER);
var_dump($resellers);
到第55行,就在这一行之前:
$reseller = $resellers[GD_RESELLER];
了解发生了什么
如果“GD_RESELLER”是一个数字,请确保$resellers数组在该位置有一个值。i、 e:
如果$RELESER阵列如下所示:
array(3) { [0]=> string(5) "first" [1]=> string(6) "second" [2]=> string(5) "third" } string(5)
和GD_经销商常数等于'2',然后要求
$resellers[GD_RESELLER]
将返回“第三”
记住PHP中的数组使用基于零的索引
因此,该数组的第一个子数组位于位置“0”而不是“1”,以此类推
请参阅PHP的about另一个简单的解决方案,只需在gd-config.PHP文件中编辑下面的代码 定义“GD_经销商”,错误
GD_经销商是一个常数吗?如果是的话,在检查是否定义它时,它是否意味着在引号中?反之亦然,如果它不是一个常数,那么它需要在is_numeric和$resellers[GD_RESELLER]上加引号,$resellers包含什么?@第55行:var_dump$经销商;看起来GD_SELLER常量值为1,并且$resolders数组中只有1个或更少的项。