我有两段PHP代码,这给了我一个错误:
警告:中的非法字符串偏移量“隐藏类” /home/creativi/public_html/wp content/plugins/authpro/content builder/models/layouts.php 在线131 这是与警告相关的代码:我有两段PHP代码,这给了我一个错误:,php,wordpress,fatal-error,Php,Wordpress,Fatal Error,警告:中的非法字符串偏移量“隐藏类” /home/creativi/public_html/wp content/plugins/authpro/content builder/models/layouts.php 在线131 这是与警告相关的代码: // mimick widgets mechanism $instance = empty($layoutInformation['layoutData']) ? array() : $layoutInformation['lay
// mimick widgets mechanism
$instance = empty($layoutInformation['layoutData']) ? array() : $layoutInformation['layoutData'];
global $thisWidgetInstanceData;
$thisWidgetInstanceData = $instance;
//Get layout styles
$styles = $this->generateLayoutStyles($instance);
$styles['hide_classes'] = null; //override hide class in admin editor
// var_dump($instance);
?>
第二个:
警告:中的非法字符串偏移量“show\u delay\u attribute”
/home/creativi/public_html/wp content/plugins/authpro/content builder/models/layouts.php
在线207
>
有关:
<div class="row-fluid<?php echo $styles['custom_classes'] ?><?php echo $styles['shadow_class'] ?><?php echo $styles['hide_classes'] ?><?php echo $styles['bg_effect_class'] ?>" id="layout-<?php echo $layoutNumber; ?>" style="<?php echo $styles['layout_style']; ?>" <?php echo $styles['show_delay_attribute']; ?>>
>
任何帮助都将不胜感激。听起来$styles是一个字符串,您试图使用另一个字符串作为数组访问它,但这不起作用 正如建议的那样,var_转储$style或在调试器中检查以了解发生了什么 通常,在执行此类操作之前,您应该检查数组键是否存在
echo$array['key']$数组['key']:''将生成空字符串,而不是错误
我认为问题在于$this->generateLayoutStyles
没有返回您所期望的内容。您可以设置变量转储($styles)代码>生成$styles并给出结果之后。