Php 我能';找不到脚本的意外结尾

Php 我能';找不到脚本的意外结尾,php,wordpress,Php,Wordpress,我在这件事上真的很挣扎。此文件在我的本地开发人员站点上运行良好,没有任何警告。将其放在活动站点上会导致致命错误,从而停止激活。我发现在这里找不到意外结局的原因。我也尝试过两个不同的现场网站 <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly function the_note_form( $atts ){ // prepare $home_page for defualt r

我在这件事上真的很挣扎。此文件在我的本地开发人员站点上运行良好,没有任何警告。将其放在活动站点上会导致致命错误,从而停止激活。我发现在这里找不到意外结局的原因。我也尝试过两个不同的现场网站

    <?php    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
function the_note_form( $atts ){ 

    // prepare $home_page for defualt return to the homepage after note submit
    $home_page = get_home_url();
        //get current users id
        $users_id = get_current_user_id();
            // shortcode information
            $id_location_form = shortcode_atts( array( 'location' => '', 'title' =>'', 'redirect' => $home_page,  'category_custom' => '', 'create_logged_out' =>'', 'create_logged_in'=>'', 'create_by_user_id' =>'', 'show_setup' =>'', 'id_can_see' => '0' ), $atts );
                //get a time stamp for the note
                $entry_date = date('l jS \of F Y h:i:s A T'); //echo"$entry_date";
                    // get current users name
                    $user_info = wp_get_current_user(); $users_name = $user_info->display_name ;






if ($id_location_form['create_logged_in'] == 'yes' && is_user_logged_in() == "true") {include('form_build.php');}
        //logged out form
       if ($id_location_form['create_logged_out'] == 'yes' && is_user_logged_in() != "true") {include('form_build.php'); }

                //specify only a user id tha can access the form.
                if ($id_location_form['create_by_user_id'] == $users_id && $id_location_form['create_by_user_id'] != '') {include('form_build.php'); }



//if the show_setup = yes then show this var_dump of the setu array
if ($id_location_form['show_setup'] == "yes"){ ?> <pre> <?php print_r($id_location_form); ?> </pre>
<?
}

//close the function
}  

add_shortcode( 'the_note_input_form', 'the_note_form' );



  /****************************
form input to database
*******************************/



$security_input = 0;


if ( isset( $_POST["submit_form"] ) && $_POST["visitor_note"] != "" ) {


    $table = $wpdb->prefix."my_notes";
    $name = strip_tags($_POST["visitor_name"], "");
    $note = strip_tags($_POST["visitor_note"], "");
    $vis_id = strip_tags($_POST["visitor_id"], "");
    $input_location = strip_tags($_POST["input_location"], "");
    $date_stamp = strip_tags($_POST["utc_create"], "");
    $category_custom = strip_tags($_POST["category_custom"], "");
    $id_can_view = strip_tags($_POST["id_can_see"], "");
    $status = strip_tags($_POST["status"], "");

    $wpdb->insert( 
        $table, 
        array( 
            'name' => $name,
            'note' => $note,
            'user_id' => $vis_id,    
            'time_of_entry' => $date_stamp,
            'input_location' => $input_location,
            'category' => $category_custom,
            'id_can_view' => $id_can_view,
            'status' => $status,
            'security' => $security_input
        )
    );

}



发布的代码运行良好。这个错误一定在别的地方。看看整个错误消息。你能启用WP调试并检查服务器日志吗?这很奇怪,我的本地服务器没有显示任何错误,但我无法在实时站点上激活插件…添加到@CharlotteDunois所说的内容中:正确的代码格式对调试有很大帮助我是新手:-)尝试整洁..哇哦,我哦,我的天啊,非常感谢。令人惊讶的是,一个安装程序将拾取这些东西,而另一个不会。刚刚更新了我的答案,解释了为什么在一个位置有效,而在另一个位置无效。最好确保在两个位置使用相同的配置(请参见php.ini)。在您的本地应用程序中很少看到启用短打开标记。我想知道你是否启用了任何其他非常旧的设置,这将再次困扰你。是的,这是完全有道理的。我知道开放标签是可以接受的,我认为这通常意味着一种装饰,以确保其他人知道它是php。也许我不认为这是一个可能的原因。我通常把它们用于良好的畜牧业,但放弃了这一点,不认为这是一个值得关注的可能原因。再次感谢。我会一直使用它们,所以不管它们会在哪里结束。这是一个新的设置,但这是一个艰难的教训1.我希望我不会有这样的困难。
//if the show_setup = yes then show this var_dump of the setu array
if ($id_location_form['show_setup'] == "yes"){ ?> <pre> <?php                
print_r($id_location_form); ?> </pre>
<?php   // was <?
}