我尝试将与PHP 7.1.25兼容的PHP版本升级到7.2或7.3。 我的选项页崩溃了,数据库中丢失了一些。 Wordpress版本是4.9.7。 插件:Tilesim(私有)Elementor和Woocommrece(最新版本1.1.19) 主题:只有一页的2017年子级。
我收到以下警告:
``PHP Warning: Cannot modify header information - headers already sent by (output started at .../wp-content/plugins/tilesim/ts_admin.php:300) in .../wp-includes/rest-api/class-wp-rest-server.php on line 1248``
注意:Google搜索显示升级到7.2可能是一个问题
由于所有代码都是由input和textarea标签组成的。 知道可能是什么问题吗?
这是我测试过的选项页面的代码 ``
add_action('admin_init', 'register_tilesim_plugin_settings');
function register_tilesim_plugin_settings() {
//register our settings
register_setting( 'tilesim-option-group', 'ts_manufacture_name' );
register_setting( 'tilesim-option-group', 'ts_manufacture_logo' );
register_setting( 'tilesim-option-group', 'ts_manufacture_email' );
// board settings
register_setting( 'tilesim-option-group', 'ts_online_help_pid' );
register_setting( 'tilesim-option-group', 'ts_init_board_width' );
register_setting( 'tilesim-option-group', 'ts_allowed_min_board_width' );
register_setting( 'tilesim-option-group', 'ts_allowed_max_board_width' );
register_setting( 'tilesim-option-group', 'ts_default_tile_size' ); // default tile size
register_setting( 'tilesim-option-group', 'ts_rotateLR_image' );
register_setting( 'tilesim-option-group', 'ts_rotateRL_image' );
register_setting( 'tilesim-option-group', 'ts_eraser_image' );
// report settings
register_setting( 'tilesim-option-group', 'ts_report_header_image' );
register_setting( 'tilesim-option-group', 'ts_report_footer_image' );
register_setting( 'tilesim-option-group', 'ts_report_title' );
register_setting( 'tilesim-option-group', 'ts_report_sigtext' ); // signature text
// css settings
register_setting( 'tilesim-option-group', 'ts_css' ); // css code
}
function ts_plugin_options() {
if ( !current_user_can( 'manage_options' ) )
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
ts_options_page();
}
function ts_options_page(){
$labelStyle= "width:130px;display:inline-block;";
$labelTextareaStyle= "width:130px;display:inline-block;vertical-align: top;";
$logoInStyle = "width: 597px;text-align: right;direction:ltr";
$EmailInStyle = "text-align: left;";
?>
<div class="wrap">
<h2>Tilesim Settings</h2><br />
<form action="options.php" method="post">
<?php settings_fields( 'tilesim-option-group' );?>
<?php do_settings_sections( 'tilesim' );?>
<label style="<?php echo $labelStyle; ?>">Manufacture Name:</label>
<input type="text" name="ts_manufacture_name" value="<?php echo get_option( 'ts_manufacture_name' ); ?>" /><br />
<label style="<?php echo $labelStyle; ?>">Manufacture Logo:</label>
<input style="<?php echo $logoInStyle ; ?>" type="text" name="ts_manufacture_logo" value="<?php echo get_option( 'ts_manufacture_logo' ); ?>" /><br />
<label style="<?php echo $labelStyle; ?>">Manufacture Email:</label>
<input style="<?php echo $EmailInStyle ; ?>" type="text" name="ts_manufacture_email" value="<?php echo get_option( 'ts_manufacture_email' ); ?>" /><br />
<h3 style="font-weight: 500;">Board settings</h3>
<label style="<?php echo $labelStyle; ?>">Help Post ID:</label>
<input type="text" name="ts_online_help_pid" value="<?php echo get_option( 'ts_online_help_pid' ); ?>" /><br />
<label style="<?php echo $labelStyle; ?>">Initial Board Width:</label>
<input type="text" name="ts_init_board_width" value="<?php echo get_option( 'ts_init_board_width' ); ?>" />
<label style="<?php echo $labelStyle; ?>">Default Tile Size:(cm)</label>
<input type="text" name="ts_default_tile_size" value="<?php echo get_option( 'ts_default_tile_size' ); ?>" /><br />
<label style="<?php echo $labelStyle; ?>">Min Board Width:</label>
<input type="text" name="ts_allowed_min_board_width" value="<?php echo get_option( 'ts_allowed_min_board_width' ); ?>" />
<label style="<?php echo $labelStyle; ?>">Max Board Width:</label>
<input type="text" name="ts_allowed_max_board_width" value="<?php echo get_option( 'ts_allowed_max_board_width' ); ?>" /><br />
<label style="<?php echo $labelStyle; ?>">Left to Right image:</label>
<input style="<?php echo $logoInStyle ; ?>" type="text" name="ts_rotateLR_image" value="<?php echo get_option( 'ts_rotateLR_image' ); ?>" /><br />
<label style="<?php echo $labelStyle; ?>">Right to left image:</label>
<input style="<?php echo $logoInStyle ; ?>" type="text" name="ts_rotateRL_image" value="<?php echo get_option( 'ts_rotateRL_image' ); ?>" /><br />
<label style="<?php echo $labelStyle; ?>">Eraser image:</label>
<input style="<?php echo $logoInStyle ; ?>" type="text" name="ts_eraser_image" value="<?php echo get_option( 'ts_eraser_image' ); ?>" /><br />
<h3 style="font-weight: 500;">Report settings</h3>
<label style="<?php echo $labelStyle; ?>">Header Image:</label>
<input style="<?php echo $logoInStyle ; ?>" type="text" name="ts_report_header_image"
value="<?php echo get_option( 'ts_report_header_image' ); ?>" /><br />
<label style="<?php echo $labelStyle; ?>">Footer Image:</label>
<input style="<?php echo $logoInStyle ; ?>" type="text" name="ts_report_footer_image"
value="<?php echo get_option( 'ts_report_footer_image' ); ?>" /><br />
<label style="<?php echo $labelStyle; ?>">Report Title:</label>
<input style="<?php echo $logoInStyle ; ?>" type="text" name="ts_report_title" value="<?php echo get_option( 'ts_report_title' ); ?>" /><br />
<label style="<?php echo $labelTextareaStyle; ?>">Report Signature:</label>
<textarea style="direction:rtl;text-align:right" type="textarea" name="ts_report_sigtext" cols="81" rows="4"><?php echo esc_html(trim(get_option( 'ts_report_sigtext' ))); ?></textarea>
<h3 style="font-weight: 500;">Css settings</h3>
<p>Note: No css validation is provided. CSS loads last. Harmful code removed.</p>
<label style="<?php echo $labelTextareaStyle; ?>">CSS code:</label>
<textarea style="direction:ltr;text-align:left" type="textarea" name="ts_css" cols="81" rows="8"><?php echo esc_html(trim(get_option( 'ts_css' ))); ?></textarea>
<?php submit_button();?>
</form>
</div>
<?php
}
?>
``