0

以下の関数の最後の配列をテーブルに挿入するのに問題があります。構文の問題を推測していますが、見つけられず、助けが必要です。この関数は、Wordpress インストールでプラグインをアクティブ化するときにデータベース値を挿入します。

function my_plugin_install_function() {
global $wpdb;
$table_name = $wpdb->prefix . "revslider_sliders";
$wpdb->insert( $table_name, array( 
           'title' => 'test',
           'alias' => 'test2',
           'params' => array (
                'title' => 'Homepage Slider',
                'alias' => 'homepage-slider',
                'shortcode' => '[rev_slider homepage-slider]',
                'slider_type' => 'fixed',
                'width' => 875,
                'height' => 350,
                'responsitive_w1' => 'NULL',
                'responsitive_sw1' => 'NULL', 
                'responsitive_w2' => 'NULL', 
                'responsitive_sw2' => 'NULL',
                'responsitive_w3' => 'NULL',
                'responsitive_sw3' => 'NULL',
                'responsitive_w4' => 'NULL',
                'responsitive_sw4' => 'NULL',
                'responsitive_w5' => 'NULL',
                'responsitive_sw5' => 'NULL',
                'responsitive_w6' => 'NULL',
                'responsitive_sw6' => 'NULL',
                'delay' => 8000,
                'touchenabled' => 'on',
                'stop_on_hover' => 'on',
                'shuffle' => 'off',
                'load_googlefont' => 'true',
                'google_font' => 'PT+Sans',
                'stop_slider' => 'off', 
                'stop_after_loops' => 0, 
                'stop_at_slide' => 2, 
                'position' => 'center', 
                'margin_top' => 0, 
                'margin_bottom' => 0,
                'margin_left' => 0, 
                'margin_right' => 0, 
                'shadow_type' => 3, 
                'show_timerbar' => 'false', 
                'timebar_position' => 'top',
                'background_color' => '#fff', 
                'padding' => 5, 
                'show_background_image' => 'true', 
                'background_image' => 'NULL', 
                'navigation_type' => 'bullet', 
                'navigation_arrows' => 'verticalcentered', 
                'navigation_style' => 'navbar-old', 
                'nav_offset_hor' => 0, 
                'nav_offset_vert' => 20, 
                'navigaion_always_on' => 'false', 
                'hide_thumbs' => 200, 
                'thumb_width' => 100, 
                'thumb_height' => 50, 
                'thumb_amount' => 5, 
                'hide_slider_under' => 0, 
                'hide_defined_layers_under' => 0, 
                'hide_all_layers_under' => 0,
                'jquery_noconflict' => 'on',
                'js_to_body' => 'false', 
                'output_type' => 'none',
                )
         ), array('%s', '%s', '')
   );
4

2 に答える 2

0

ワイルドな推測が表示されます。

'params' => array (//...
    'output_type' => 'none',
)

最後のコンマ ( ,) を削除してから'none'

ラインは

'output_type' => 'none'

私は WP 関数に詳しくありませんが、これはよくある構文エラーです。確かにPHPエラーが表示されます。

于 2013-04-15T01:40:42.850 に答える