0

这是我正在开发的 wordpress 插件的代码。

        <?php
    /*
        Plugin Name: My Javascript Plugin
    */

    // add the admin options page
    add_action('admin_menu', 'plugin_admin_add_page');
    function plugin_admin_add_page() {
    add_menu_page('Jesus Is Lord', 'Lord Jesus', 'manage_options', 'plugin', 
                  'plugin_options_page');


    }
    ?>

    <?php 
    // display the admin options page
    function plugin_options_page() {
    ?>
    <div>
    <h2>Jesus Is Lord</h2>
    In the beginning God created the Heavens and the Earth.

    <form action="options.php" method="post">
    <?php settings_fields('plugin_options'); ?>
    <?php do_settings_sections('plugin'); ?>        
    <input name="Submit" type="submit" value="<?php esc_attr_e('Jesus Saves'); ?>" />
    </form>
    </div>
    <?php } ?>

    <?php 
    add_action('admin_init', 'plugin_admin_init');
    function plugin_admin_init(){
    register_setting( 'plugin_options', 'plugin_options', 'plugin_options_validate' );
    add_settings_section('plugin_main', 'Main Settings', 'plugin_section_text', 
                        'plugin');
    add_settings_field('plugin_text_string', 'Plugin Text Input', 
                       'plugin_setting_string', 'plugin', 'plugin_main');
    ?>

我是插件开发的新手,我不知道为什么会出现这个错误:

Parse error: syntax error, unexpected $end in C:\xampp\htdocs\...\wp-content\plugins\myjavascriptplugin\myjavascriptplugin.php on line 42
4

2 回答 2

3

您永远不会关闭该功能plugin_admin_init

您在代码中}的 final 之前缺少一个右大括号。?>

于 2012-05-08T02:58:43.053 回答
0

}您的代码中缺少 a

于 2012-05-08T03:25:37.723 回答