Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/255.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
分析错误:语法错误,意外的metabox.php custon侧边栏_Php_Html_Wordpress_Plugins - Fatal编程技术网

分析错误:语法错误,意外的metabox.php custon侧边栏

分析错误:语法错误,意外的metabox.php custon侧边栏,php,html,wordpress,plugins,Php,Html,Wordpress,Plugins,我将生产服务器的approval迁移到wordpress,最后在一个名为“custom sidebar”的插件中给出了以下消息:Parse error:syntax error,第2行的“/home/storage/c/ff/92/sindpfpr/public\u html/wp content/plugins/custom sidebars/views/metabox.php”中意外出现的T_GLOBAL遵循指出错误的代码,我非常感谢在这个问题上帮助我的人,谢谢 <?php /**

我将生产服务器的approval迁移到wordpress,最后在一个名为“custom sidebar”的插件中给出了以下消息:Parse error:syntax error,第2行的“/home/storage/c/ff/92/sindpfpr/public\u html/wp content/plugins/custom sidebars/views/metabox.php”中意外出现的T_GLOBAL遵循指出错误的代码,我非常感谢在这个问题上帮助我的人,谢谢

<?php
/**
 * Metabox inside posts/pages where user can define custom sidebars for an
 * individual post.
 */

global $wp_registered_sidebars;

$available = $wp_registered_sidebars;
$sidebars = CustomSidebars::get_options( 'modifiable' );
?>

<p>
    <?php _e(
        'Here you can replace the default sidebars. Simply select what ' .
        'sidebar you want to show for this post!', CSB_LANG
    ); ?>
</p>

<?php if ( ! empty( $sidebars ) ) { ?>
    <?php foreach ( $sidebars as $s ) { ?>
        <?php $sb_name = $available[ $s ]['name']; ?>
        <p>
            <b><?php echo esc_html( $sb_name ); ?></b>:
            <select name="cs_replacement_<?php echo esc_attr( $s ); ?>">
                <option value=""></option>
                <?php foreach ( $available as $a ) : ?>
                <option value="<?php echo esc_attr( $a['id'] ); ?>" <?php selected( $selected[ $s ], $a['id'] ); ?>>
                    <?php echo esc_html( $a['name'] ); ?>
                </option>
                <?php endforeach; ?>
            </select>
        </p>
    <?php
    }
} else {
    ?>
    <p id="message" class="updated">
        <?php _e(
            'All sidebars have been locked, you cannot replace them. ' .
            'Go to <a href="widgets.php">the widgets page</a> to unlock a ' .
            'sidebar', CSB_LANG
        ); ?>
    </p>
    <?php
}


:
我认为这个问题是因为《全球宣言》已经在全球范围内。只能在函数/方法中使用全局声明


但是,在函数中使用全局变量是一种不好的做法,我不建议这样做。

谢谢你的回复,但我只使用了这个插件,我在aws和我的电脑上都使用过它,它很有效,只出现在主持这个problem@user2350939这可能是因为不同的版本强制执行不同的标准,但拥有这种全局声明的代码是不合适的。您是否尝试过在顶部对全球宣言进行注释,看看这是否解决了问题?错误消息显然是关于全局的。