Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.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
Php 致命错误:分析错误:语法错误,意外的$end in_Php_Wordpress - Fatal编程技术网

Php 致命错误:分析错误:语法错误,意外的$end in

Php 致命错误:分析错误:语法错误,意外的$end in,php,wordpress,Php,Wordpress,这是wordpress插件,它在旧的PHP版本上运行良好,但现在在PHP5.4.X上运行时产生以下错误 无法激活插件,因为它触发了致命错误 分析错误:语法错误,第175行的C:\wamp\www\testweb\wp content\plugins\bxslider\slider.php中出现意外的$end 这是SLIDER.PHP文件 <?php error_reporting(1); if(!defined('ABSPATH')) { die("Don't call this

这是wordpress插件,它在旧的PHP版本上运行良好,但现在在PHP5.4.X上运行时产生以下错误

无法激活插件,因为它触发了致命错误

分析错误:语法错误,第175行的C:\wamp\www\testweb\wp content\plugins\bxslider\slider.php中出现意外的$end

这是SLIDER.PHP文件

<?php
error_reporting(1);
if(!defined('ABSPATH')) {
    die("Don't call this file directly.");
}
if (!defined('WP_CONTENT_URL')) {
    define('WP_CONTENT_URL', get_option('siteurl').'/wp-content');
}
define('CONTENT_SLIDE_URL',get_option('siteurl').'/wp-content/plugins/bxslider/');



/* Add Administrator Menu's*/
function bx_content_slide_menu()
{
    $level = 'level_10';
   add_menu_page('BX Content Slide', 'BX Content Slide', $level, __FILE__,'bx_content_slide_options',CONTENT_SLIDE_URL.'images/icon6.png');
   add_submenu_page(__FILE__, 'Help &amp; Support', 'Help &amp; Support', $level,'bx_content_slide_help','bx_content_slide_help');
}
add_action('admin_menu', 'bx_content_slide_menu');

function bx_content_slide_options()
{
    bx_settings_update();
    global $wpdb;
    $query="Select * from wp_slider";
    $slider_res=$wpdb->get_results($query);

    if($_GET['mode']=='edit'){
        $query="select * from wp_slider where id='".$_GET['id']."'";
        $cur_slider_res=$wpdb->get_results($query);


    }

    include_once dirname(__FILE__).'/options_page.php';
}


function bx_settings_update(){
    global $wpdb;
    if(isset($_POST['total_options']))
    {
        echo '<div class="updated fade" id="message"><p>Content Slide Settings <strong>Updated</strong></p></div>';


        for($i=1;$i<=($_POST['total_options']-1);$i++){
            if(!empty($_POST['wpcs_options']['slide_imagetext'.$i])){   
        $query="INSERT INTO `wp_slider` (`image`, `link`, `content`,`name`) VALUES ('".$_POST['wpcs_options']['slide_image'.$i]."', '".$_POST['wpcs_options']['slide_imagelink'.$i]."', '".$_POST['wpcs_options']['slide_imagetext'.$i]."', '".$_POST['name']."');";
        $wpdb->query($query);
            }
        }
        //update_option('bx_options', $_POST['bx_options']);
    }
    if($_GET['mode']=='delete'){
        $wpdb->query("Delete from wp_slider where id='".$_GET['id']."'");
        header("location:admin.php?page=bxslider/slider.php" );
    }
    if($_GET['mode']=='edit' && isset($_POST['id'])){

    $wpdb->query("update wp_slider set image='".$_POST['wpcs_options']['slide_image1']."', link='".$_POST['wpcs_options']['slide_imagelink1']."', content='".$_POST['wpcs_options']['slide_imagetext1'] ."',name='".$_POST['name']  ."' where id='".$_POST['id']."'");
        header("location:admin.php?page=bxslider/slider.php" ); 

    }


}


function createTable()
{
      global $wpdb;

    $qndTable = $wpdb->prefix . "slider";

    if($wpdb->get_var("show tables like '$qndTable'") != $qndTable)
    {
        $create =   "CREATE TABLE " . $qndTable . " (
                              `id` int(11) NOT NULL AUTO_INCREMENT,
                              `image` varchar(255) NOT NULL,
                              `link` varchar(255) NOT NULL,
                              `content` text NOT NULL,
                              `name` varchar(255) NOT NULL,
                              PRIMARY KEY (`id`)
                            ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;";

        require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
        dbDelta($create);

    }
}
function deleteTable(){
     global $wpdb;
     $wpdb->query("DROP table ".$wpdb->prefix . "slider");

}

register_activation_hook(__FILE__,  'createTable');

register_deactivation_hook(__FILE__,  'deleteTable');


function bxcontent_slider( $atts ) {
    $sname=$atts[slider];
    $type=$atts[type];
    if(!$type) $type='image';
    global $wpdb;
    $query="Select * from wp_slider where name='".$sname."' ";
    $slider_res=$wpdb->get_results($query);


    addbx_head($sname);         

    if($type=='image'){
    $content .='<ul class="'.$sname.'">';   
        foreach($slider_res as $slider){
            $content .= '<li><img src="'.$slider->image.'" /></li>';
        }
    $content .='</ul>';
    }elseif($type=='content'){
    $content .='<div class="'.$sname.'">';  
        foreach($slider_res as $slider){
        $content .= '<div>'.$slider->content.'</div>';
        }
        $content .='</div>';
    }

    return $content;
    // echo  "slider = {$atts[slider]}";
}
add_shortcode('bxcontentslider', 'bxcontent_slider');
function addbx_head($sname){
?>
<script language='javascript'>
                var $jquery = jQuery.noConflict(); 
                $jquery(document).ready(function(){

                  $jquery('.<?php echo $sname ?>').bxSlider({
                      auto:true,
                      controls:false,
                       pagerCustom: '#bx-pager-<?php echo $sname?>',
                       pagerActiveClass:"active"
                      });


                });

                </script>
<?
}
function add_bxjs() {
    /*wp_enqueue_script(
        'custom-script',
        plugins_url('/bxslider/jquery.bxslider.js', __FILE__ ) ,
        array( 'jquery' )
    );*/
    wp_enqueue_style('bxstyle', plugins_url('/bxslider/jquery.bxslider.css', __FILE__ ));
    wp_enqueue_script('jquery',plugins_url('/bxslider/jquery.min.js', __FILE__ ), array('jquery'));
    wp_enqueue_script('easing',plugins_url('/bxslider/jquery.easing.1.3.js', __FILE__ ), array('jquery'));
    wp_enqueue_script('bxscript',plugins_url('/bxslider/jquery.bxslider.js', __FILE__ ), array('jquery'));
}

add_action( 'wp_enqueue_scripts', 'add_bxjs' );

您对php默认标记和短标记有问题

<? ... ?>   PHP short tag
<?php ... ?> PHP default tag
PHP短标记
PHP默认标记
有关更多详细信息,请参阅

请用以下代码替换最后几行

<?php
}
function add_bxjs() {
    /*wp_enqueue_script(
        'custom-script',
        plugins_url('/bxslider/jquery.bxslider.js', __FILE__ ) ,
        array( 'jquery' )
    );*/
    wp_enqueue_style('bxstyle', plugins_url('/bxslider/jquery.bxslider.css', __FILE__ ));
    wp_enqueue_script('jquery',plugins_url('/bxslider/jquery.min.js', __FILE__ ), array('jquery'));
    wp_enqueue_script('easing',plugins_url('/bxslider/jquery.easing.1.3.js', __FILE__ ), array('jquery'));
    wp_enqueue_script('bxscript',plugins_url('/bxslider/jquery.bxslider.js', __FILE__ ), array('jquery'));
}

add_action( 'wp_enqueue_scripts', 'add_bxjs' );
?>


谢谢,现在工作很好。这帮我修复了另一个Wordpress插件。注意,搜索整个php.ini,因为在我的php.ini中,short_open_标记定义了两次。