简体   繁体   中英

PHP Parse error: syntax error, unexpected $end

Here is my code for a wordpress plugin that I am developing.

        <?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');
    ?>

I am new to plugin development and I can't figure out why I am getting this error:

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

You never close the function plugin_admin_init .

You're missing a closing brace } before the final ?> in your code.

您的代码中缺少}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM