我最近迁移了一个网站。旧服务器cPanel运行PHP 5.3.28 - 新服务器运行5.4.34;现在这些错误出现了:
Warning: Illegal string offset 'sidebar_change' in /home/psdive/public_html/homedir/rdoc/wp-content/themes/RDOC2/RDOC2/includes/tt_meta.php on line 3
Warning: Illegal string offset 'sl_pos' in ...tt_meta.php on line 4
Warning: Illegal string offset 'primary_width' in ...tt_meta.php on line 5
Warning: Illegal string offset 'secondary_width' in ...tt_meta.php on line 6
Warning: Illegal string offset 'special_width' in ...tt_meta.php on line 7
这是代码:
<?php
$meta_test2 = $custom_sidebar->the_meta();
$sb_change = $meta_test2['sidebar_change'];
$sb_style = $meta_test2['sl_pos'];
$primary_width = $meta_test2['primary_width'];
$secondary_width = $meta_test2['secondary_width'];
$special_width = $meta_test2['special_width'];
global $primary_width, $secondary_width, $special_width;
$meta_test3 = $custom_back->the_meta();
$back_change = $meta_test3['back_change'];
$background_color = $meta_test3['background_color'];
$background_url = $meta_test3['background_url'];
$background_repeat = $meta_test3['background_repeat'];
$header_change = $meta_test3['header_change'];
$header2_change = $meta_test3['header2_change'];
$header_url = $meta_test3['header_url'];
$header_url2 = $meta_test3['header_url2'];
global $back_change, $background_color, $background_url, $background_repeat;
if ($back_change) {?><style type='text/css'>body {background: #<?php echo $background_color ;?> url("<?php echo $background_url; ?>") <?php echo $background_repeat ;?>;}</style><?php }
if ($header2_change) { ?><style type='text/css'>.fn-header:before{background-image: url('<?php echo $header_url2; ?>'); } </style><?php }
if ($header_change) { ?><style type='text/css'>.fn-header:after{ background-image: url('<?php echo $header_url; ?>'); } </style> <?php }
if ($sb_change == 'Yes' ) { ?><style type='text/css'>.fn-content-layout .fn-sidebar2:before, .fn-content-layout .fn-sidebar1:before {width: 0px;}</style><?php }
?>
有没有办法修复此代码而不是恢复到PHP 5.3?