WordPress产品导入后内容出现乱码,以及附属一些别的功能
效果图如下
该插件附带了一个可以把产品描述里面的超链接给去掉,以及有的产品图片点击会在地址栏上面显示图片的路径,在该插件可以进行关闭,并且替换成一个模态窗,还有对产品邮费展示进行了处理,到金额到达包邮的时候,别的邮费进行隐藏
下面是该插件源码
目录结构
duola
duola.php
scripts.js
styles.css
duola.php文件
<?php
/*
Plugin Name: 产品数据内容处理
Description: 产品标题以及描述中,如果有原本网站的数据,使用这个插件进行处理(新版本功能:增加了产品详情,给产品图片新增了一个模态窗,以及产品隐藏其他运费增加了一个快捷按钮和产品描述去超链接)
Version: 2.3.4
Author: 朵啦
*/ if (!defined('ABSPATH')) {
exit; // 如果直接访问,退出
} class ContentReplacer {
public function __construct() {
// 添加后台菜单
add_action('admin_menu', array($this, 'add_admin_menu'));
// 处理表单提交
add_action('admin_post_replace_content', array($this, 'handle_form_submission'));
// 处理回滚
add_action('admin_post_rollback_content', array($this, 'handle_rollback'));
// 处理免运费隐藏按钮的表单提交
add_action('admin_post_toggle_shipping', array($this, 'handle_toggle_shipping'));
// 处理产品模态窗按钮的表单提交
add_action('admin_post_toggle_modal', array($this, 'handle_toggle_modal')); add_action('admin_post_toggle_hyperlink', array($this, 'handle_toggle_hyperlink'));
add_action('admin_post_close_hyperlink', array($this, 'handle_close_hyperlink')); // 检查简码状态的AJAX处理
add_action('wp_ajax_check_shortcode_status', array($this, 'check_shortcode_status'));
// 添加样式和脚本
add_action('admin_enqueue_scripts', array($this, 'enqueue_styles'));
} // 添加后台菜单项
public function add_admin_menu() {
add_menu_page(
'产品数据内容处理', // 页面标题
'产品数据内容处理', // 菜单标题
'manage_options', // 权限
'content-replacer', // 菜单别名
array($this, 'create_admin_page'), // 页面内容的回调函数
'dashicons-admin-tools' // 图标
);
} public function enqueue_styles() {
wp_enqueue_style('content-replacer-styles', plugins_url('styles.css', __FILE__));
wp_enqueue_script('content-replacer-scripts', plugins_url('scripts.js', __FILE__), array('jquery'), null, true);
wp_add_inline_style('content-replacer-styles', '
#adminmenu .toplevel_page_content-replacer .wp-menu-image:before {
content: "";
display: inline-block;
width: 20px;
height: 20px;
background-image: url(' . plugins_url('img/icon.png', __FILE__) . ');
background-size: cover;
}
');
} // 创建后台页面
public function create_admin_page() {
?>
<div class="wrap content-replacer-container">
<h1>产品数据内容处理</h1>
<form method="post" action="<?php echo admin_url('admin-post.php'); ?>" id="content-replacer-form">
<input type="hidden" name="action" value="replace_content">
<?php wp_nonce_field('replace_content_nonce', 'replace_content_nonce_field'); ?>
<table class="form-table">
<tr valign="top">
<th scope="row"><label for="original_text">原始内容</label></th>
<td><input type="text" id="original_text" name="original_text" required /></td>
</tr>
<tr valign="top">
<th scope="row"><label for="new_text">新内容</label></th>
<td><input type="text" id="new_text" name="new_text" required /></td>
</tr>
</table>
<p class="submit"><input type="submit" class="button-primary" value="替换内容" /></p>
<div id="loading" class="loading">正在处理中,请稍候...</div>
<div class="progress-bar" id="progress-bar">
<div class="progress-bar-inner" id="progress-bar-inner"></div>
</div>
</form> <h2>替换历史</h2>
<ul>
<?php
$history = get_option('content_replacer_history', array());
if (empty($history)) {
echo '<li>还没有进行过替换。</li>';
} else {
$history_by_date = [];
foreach ($history as $entry) {
$date = date('Y-m-d H:i:s', strtotime($entry['date']));
if (!isset($history_by_date[$date])) {
$history_by_date[$date] = ['entries' => [], 'count' => 0];
}
$history_by_date[$date]['entries'][] = '"' . esc_html($entry['original_text']) . '" 替换为 "' . esc_html($entry['new_text']) . '"';
$history_by_date[$date]['count'] += $entry['replacements'];
} foreach ($history_by_date as $date => $data) {
$entries = array_unique($data['entries']); // 去除重复项
echo '<li>';
echo '于 ' . esc_html($date) . ' 替换: ';
echo implode(', ', $entries);
echo ' 共 ' . $data['count'] . ' 处改动 ';
echo ' <a href="' . wp_nonce_url(admin_url('admin-post.php?action=rollback_content&date=' . urlencode($date)), 'rollback_content_nonce', 'rollback_content_nonce_field') . '">回滚</a>';
echo '</li>';
}
}
?>
</ul>
</div> <div class="wrap content-replacer-container"> <!-- 新按钮:免运费隐藏 -->
<form method="post" action="<?php echo admin_url('admin-post.php'); ?>" id="shipping-toggle-form">
<input type="hidden" name="action" value="toggle_shipping">
<?php wp_nonce_field('toggle_shipping_nonce', 'toggle_shipping_nonce_field'); ?>
<p class="submit"><input type="submit" class="button-primary" id="toggle-shipping-button" value="免运费隐藏" /></p>
</form> <!-- 新按钮:产品模态窗 -->
<form method="post" action="<?php echo admin_url('admin-post.php'); ?>" id="modal-toggle-form">
<input type="hidden" name="action" value="toggle_modal">
<?php wp_nonce_field('toggle_modal_nonce', 'toggle_modal_nonce_field'); ?>
<p class="submit"><input type="submit" class="button-primary" id="toggle-modal-button" value="产品模态窗" /></p>
</form> <!-- 新按钮:去产品超链接 -->
<form method="post" action="<?php echo admin_url('admin-post.php'); ?>" id="hyperlink-toggle-form">
<input type="hidden" name="action" value="toggle_hyperlink">
<?php wp_nonce_field('toggle_hyperlink_nonce', 'toggle_hyperlink_nonce_field'); ?>
<p class="submit"><input type="submit" class="button-primary" id="toggle-hyperlink-button" value="检查中..." /></p>
</form> <!-- 新按钮:关闭描述去超链接功能 -->
<form method="post" action="<?php echo admin_url('admin-post.php'); ?>" id="hyperlink-close-form" style="display:none;">
<input type="hidden" name="action" value="close_hyperlink">
<?php wp_nonce_field('close_hyperlink_nonce', 'close_hyperlink_nonce_field'); ?>
<p class="submit"><input type="submit" class="button-primary" id="close-hyperlink-button" value="关闭描述去超链接功能" /></p>
</form> </div>
<script>
jQuery(document).ready(function($) {
$('#content-replacer-form').on('submit', function() {
$('#loading').hide();
$('#progress-bar').show();
var progressBar = $('#progress-bar-inner');
var width = 0;
var interval = setInterval(function() {
if (width >= 100) {
clearInterval(interval);
$('#progress-bar').hide();
} else {
width += 1; // 增加进度的步长
progressBar.css('width', width + '%');
progressBar.text(width + '%');
}
}, 50); // 模拟进度,逐步增加
}); // 隐藏其他插件提示
$('.notice, .update-nag, .updated, .error, .is-dismissible').not('.content-replacer-container .notice').hide(); // 检查 function.php 中是否有相关简码
$.ajax({
url: ajaxurl,
data: {
'action': 'check_shortcode_status'
},
success: function(response) {
if (response.shipping_hidden) {
$('#toggle-shipping-button').val('其他运费已隐藏');
}
if (response.modal_enabled) {
$('#toggle-modal-button').val('产品图片模态窗已开启');
}
if (response.hyperlinks_exist) {
$('#toggle-hyperlink-button').val('描述有超链接,点击去掉').css({
'background-color': '#ff6666',
'color': '#f5f5dc'
}).prop('disabled', false);
} else {
$('#toggle-hyperlink-button').val('产品无链接,无需点击此按钮').css({
'background-color': '#add8e6',
'color': '#ffffff'
}).prop('disabled', true);
}
}
}); // 当去掉超链接按钮被点击
$('#hyperlink-toggle-form').on('submit', function() {
$('#toggle-hyperlink-button').val('超链接已去掉,无需点击此按钮').prop('disabled', true);
$('#close-hyperlink-button').parent().show();
}); // 当关闭超链接功能按钮被点击
$('#hyperlink-close-form').on('submit', function() {
$('#toggle-hyperlink-button').val('描述有超链接,点击去掉').prop('disabled', false);
$('#close-hyperlink-button').parent().hide();
}); });
</script>
<?php
} // 处理表单提交
public function handle_form_submission() {
if (!isset($_POST['replace_content_nonce_field']) || !wp_verify_nonce($_POST['replace_content_nonce_field'], 'replace_content_nonce')) {
wp_die('Nonce 验证失败');
} if (!current_user_can('manage_options')) {
wp_die('无权限');
} $original_text = sanitize_text_field($_POST['original_text']);
$new_text = sanitize_text_field($_POST['new_text']); global $wpdb; // 获取所有产品
$products = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt FROM {$wpdb->posts} WHERE post_type = 'product'"); // 在替换前保存原始数据
$history = get_option('content_replacer_history', array());
$total_replacements = 0;
foreach ($products as $product) {
$original_data = array(
'ID' => $product->ID,
'post_title' => $product->post_title,
'post_content' => $product->post_content,
'post_excerpt' => $product->post_excerpt,
);
$title_replacements = substr_count($product->post_title, $original_text);
$content_replacements = substr_count($product->post_content, $original_text);
$excerpt_replacements = substr_count($product->post_excerpt, $original_text);
$total_replacements += $title_replacements + $content_replacements + $excerpt_replacements;
$history_entry = array(
'date' => current_time('mysql'),
'original_text' => $original_text,
'new_text' => $new_text,
'data' => $original_data,
'replacements' => $total_replacements,
);
array_unshift($history, $history_entry); // 添加到数组开头
}
update_option('content_replacer_history', $history); // 执行替换操作
foreach ($products as $product) {
$updated_post = array(
'ID' => $product->ID,
'post_title' => str_replace($original_text, $new_text, $product->post_title),
'post_content' => str_replace($original_text, $new_text, $product->post_content),
'post_excerpt' => str_replace($original_text, $new_text, $product->post_excerpt),
);
$wpdb->update(
$wpdb->posts,
$updated_post,
array('ID' => $product->ID)
);
} wp_redirect(admin_url('admin.php?page=content-replacer'));
exit;
} // 处理回滚操作
public function handle_rollback() {
if (!isset($_GET['rollback_content_nonce_field']) || !wp_verify_nonce($_GET['rollback_content_nonce_field'], 'rollback_content_nonce')) {
wp_die('Nonce 验证失败');
} if (!current_user_can('manage_options')) {
wp_die('无权限');
} $date = urldecode($_GET['date']);
$history = get_option('content_replacer_history', array()); // 筛选出指定日期的历史记录
$entries_to_rollback = array_filter($history, function($entry) use ($date) {
return date('Y-m-d H:i:s', strtotime($entry['date'])) === $date;
}); if (!empty($entries_to_rollback)) {
global $wpdb;
foreach ($entries_to_rollback as $entry) {
$original_data = $entry['data'];
$wpdb->update(
$wpdb->posts,
array(
'post_title' => $original_data['post_title'],
'post_content' => $original_data['post_content'],
'post_excerpt' => $original_data['post_excerpt'],
),
array('ID' => $original_data['ID'])
);
} // 移除已回滚的历史记录
$history = array_filter($history, function($entry) use ($date) {
return date('Y-m-d H:i:s', strtotime($entry['date'])) !== $date;
});
update_option('content_replacer_history', $history); wp_redirect(admin_url('admin.php?page=content-replacer'));
exit;
} else {
wp_die('无效的历史记录日期');
}
} // 处理免运费隐藏按钮的表单提交
public function handle_toggle_shipping() {
if (!isset($_POST['toggle_shipping_nonce_field']) || !wp_verify_nonce($_POST['toggle_shipping_nonce_field'], 'toggle_shipping_nonce')) {
wp_die('Nonce 验证失败');
} if (!current_user_can('manage_options')) {
wp_die('无权限');
} $function_code = "
function js_hide_all_shipping_when_free_is_available( \$shipping_rates ) {
foreach ( \$shipping_rates as \$key => \$rate ) {
if ( \$rate->get_method_id() == 'free_shipping' ) {
\$shipping_rates = array( \$key => \$rate );
}
}
return \$shipping_rates;
}
add_filter( 'woocommerce_package_rates', 'js_hide_all_shipping_when_free_is_available' );
"; $functions_path = get_template_directory() . '/functions.php';
$functions_content = file_get_contents($functions_path); if (strpos($functions_content, 'js_hide_all_shipping_when_free_is_available') === false) {
file_put_contents($functions_path, $functions_content . PHP_EOL . $function_code);
} else {
$functions_content = str_replace($function_code, '', $functions_content);
file_put_contents($functions_path, $functions_content);
} wp_redirect(admin_url('admin.php?page=content-replacer'));
exit;
} // 处理产品模态窗按钮的表单提交
public function handle_toggle_modal() {
if (!isset($_POST['toggle_modal_nonce_field']) || !wp_verify_nonce($_POST['toggle_modal_nonce_field'], 'toggle_modal_nonce')) {
wp_die('Nonce 验证失败');
} if (!current_user_can('manage_options')) {
wp_die('无权限');
} $function_code = "
function theme_enqueue_scripts_and_styles() {
wp_enqueue_style('custom-style', get_stylesheet_directory_uri() . '/css/custom-style.css');
wp_enqueue_script('custom-script', get_template_directory_uri() . '/js/custom-script.js', array('jquery'), null, true);
\$inline_script = \"jQuery(document).ready(function($) {
\$('body').append('<div id=\\\"myModal\\\" class=\\\"modal\\\"><span class=\\\"close\\\">×</span><img class=\\\"modal-content\\\" id=\\\"img01\\\"></div>'); var modal_css = '<style>\
.modal {display: none; position: fixed; z-index: 1000; padding-top: 100px; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgb(0,0,0); background-color: rgba(0,0,0,0.9);}\
.modal-content {margin: auto; display: block; max-width: 40%; transition: transform 0.3s;}\
.close {position: absolute; top: 15px; right: 35px; color: white; font-size: 40px; font-weight: bold; cursor: pointer;}\
</style>';
\$('head').append(modal_css); var isZoomed = false; \$('.woocommerce-product-gallery__image a').click(function(event) {
event.preventDefault();
var imgSrc = \$(this).find('img').attr('src');
\$('#img01').attr('src', imgSrc);
\$('#myModal').css('display', 'block');
isZoomed = false;
\$('#img01').css('transform', 'scale(1)');
}); \$('.close, .modal').on('click', function(event) {
if (event.target !== this) return;
\$('#myModal').css('display', 'none');
}); \$('#img01').on('dblclick', function() {
if (isZoomed) {
\$(this).css('transform', 'scale(1)');
isZoomed = false;
} else {
\$(this).css('transform', 'scale(2)');
isZoomed = true;
}
});
});
\"; wp_add_inline_script('custom-script', \$inline_script);
} add_action('wp_enqueue_scripts', 'theme_enqueue_scripts_and_styles');
"; $functions_path = get_template_directory() . '/functions.php';
$functions_content = file_get_contents($functions_path); if (strpos($functions_content, 'theme_enqueue_scripts_and_styles') === false) {
file_put_contents($functions_path, $functions_content . PHP_EOL . $function_code);
} else {
$functions_content = str_replace($function_code, '', $functions_content);
file_put_contents($functions_path, $functions_content);
} wp_redirect(admin_url('admin.php?page=content-replacer'));
exit;
} // 处理去产品超链接按钮的表单提交
public function handle_toggle_hyperlink() {
if (!isset($_POST['toggle_hyperlink_nonce_field']) || !wp_verify_nonce($_POST['toggle_hyperlink_nonce_field'], 'toggle_hyperlink_nonce')) {
wp_die('Nonce 验证失败');
} if (!current_user_can('manage_options')) {
wp_die('无权限');
} $function_code = "
function remove_product_hyperlinks(\$content) {
if (is_product()) {
\$content = preg_replace('/<a href=\".*?\">(.*?)<\/a>/', '\$1', \$content);
}
return \$content;
}
add_filter('the_content', 'remove_product_hyperlinks');
"; $functions_path = get_template_directory() . '/functions.php';
$functions_content = file_get_contents($functions_path); if (strpos($functions_content, 'remove_product_hyperlinks') === false) {
file_put_contents($functions_path, $functions_content . PHP_EOL . $function_code);
} wp_redirect(admin_url('admin.php?page=content-replacer'));
exit;
} // 处理关闭去超链接功能按钮的表单提交
public function handle_close_hyperlink() {
if (!isset($_POST['close_hyperlink_nonce_field']) || !wp_verify_nonce($_POST['close_hyperlink_nonce_field'], 'close_hyperlink_nonce')) {
wp_die('Nonce 验证失败');
} if (!current_user_can('manage_options')) {
wp_die('无权限');
} $functions_path = get_template_directory() . '/functions.php';
$functions_content = file_get_contents($functions_path);
$function_code = "
function remove_product_hyperlinks(\$content) {
if (is_product()) {
\$content = preg_replace('/<a href=\".*?\">(.*?)<\/a>/', '\$1', \$content);
}
return \$content;
}
add_filter('the_content', 'remove_product_hyperlinks');
"; if (strpos($functions_content, 'remove_product_hyperlinks') !== false) {
$functions_content = str_replace($function_code, '', $functions_content);
file_put_contents($functions_path, $functions_content);
} wp_redirect(admin_url('admin.php?page=content-replacer'));
exit;
} // 新增 AJAX 处理函数,检测简码状态
// 新增 AJAX 处理函数,检测产品描述中的超链接状态
public function check_shortcode_status() {
$functions_path = get_template_directory() . '/functions.php';
$functions_content = file_get_contents($functions_path); $response = array(
'shipping_hidden' => strpos($functions_content, 'js_hide_all_shipping_when_free_is_available') !== false,
'modal_enabled' => strpos($functions_content, 'theme_enqueue_scripts_and_styles') !== false,
'hyperlinks_exist' => false
);
global $wpdb;
$products = $wpdb->get_results("SELECT post_content FROM {$wpdb->posts} WHERE post_type = 'product'");
foreach ($products as $product) {
if (preg_match('/<a href=\".*?\">/', $product->post_content)) {
$response['hyperlinks_exist'] = true;
break;
}
} wp_send_json($response);
}
} // 实例化插件类
new ContentReplacer();
scripts.js文件
// scripts.js jQuery(document).ready(function($) {
$('#content-replacer-form').on('submit', function() {
$('#loading').show();
});
// 隐藏其他插件提示
$('.notice, .update-nag, .updated, .error, .is-dismissible').not('.content-replacer-container .notice').hide(); // 提交表单时显示 loading 动画
$('#shipping-toggle-form, #modal-toggle-form').on('submit', function() {
$('#loading').show();
}); // 检查 function.php 中是否有相关简码
$.ajax({
url: ajaxurl,
data: {
'action': 'check_shortcode_status'
},
success: function(response) {
if (response.shipping_hidden) {
$('#toggle-shipping-button').val('其他运费已隐藏');
}
if (response.modal_enabled) {
$('#toggle-modal-button').val('产品图片模态窗已开启');
}
if (response.hyperlinks_exist) {
$('#toggle-hyperlink-button').val('描述有超链接,点击去掉').css({
'background-color': '#ff6666',
'color': '#f5f5dc'
}).prop('disabled', false);
} else {
$('#toggle-hyperlink-button').val('产品无链接,无需点击此按钮').css({
'background-color': '#add8e6',
'color': '#ffffff'
}).prop('disabled', true);
} }
}); // 当去掉超链接按钮被点击
$('#hyperlink-toggle-form').on('submit', function() {
$('#toggle-hyperlink-button').val('超链接已去掉,无需点击此按钮').prop('disabled', true);
$('#close-hyperlink-button').parent().show();
}); // 当关闭超链接功能按钮被点击
$('#hyperlink-close-form').on('submit', function() {
$('#toggle-hyperlink-button').val('描述有超链接,点击去掉').prop('disabled', false);
$('#close-hyperlink-button').parent().hide();
});
});
styles.css文件
/* styles.css */ /* 渐变背景色 */
.content-replacer-container {
background: linear-gradient(135deg, #f9f1e9, #f5e0d3);
padding: 20px;
border-radius: 10px;
color: #333;
max-width: 800px;
margin: 50px auto;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
text-align: center;
} .content-replacer-container h1 {
text-align: center;
margin-bottom: 20px;
font-size: 2em;
} .content-replacer-container .form-table {
width: 100%;
margin: 0 auto;
} .content-replacer-container .form-table th,
.content-replacer-container .form-table td {
padding: 10px;
text-align: left;
} .content-replacer-container input[type="text"] {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
margin-bottom: 10px;
box-sizing: border-box;
} .content-replacer-container .button-primary {
background: #ffba00;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
transition: background 0.3s;
} .content-replacer-container .button-primary:hover {
background: #ff9500;
} .content-replacer-container .loading {
display: none;
text-align: center;
padding: 10px;
margin-top: 20px;
border-radius: 5px;
color: #000; /* 将文字颜色改为黑色 */
font-weight: bold;
} .content-replacer-container .progress-bar {
display: none;
width: 100%;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 5px;
overflow: hidden;
margin-top: 20px;
position: relative;
} .content-replacer-container .progress-bar-inner {
height: 30px;
background-color: #00aaff;
width: 0;
line-height: 30px;
color: #fff;
text-align: center;
white-space: nowrap;
transition: width 0.5s ease; /* 平滑的过渡效果 */
} /* 替换历史样式 */
.content-replacer-container ul {
list-style: none;
padding: 0;
} .content-replacer-container ul li {
background: rgba(255, 255, 255, 0.2);
margin-bottom: 10px;
padding: 10px;
border-radius: 5px;
} .content-replacer-container ul li a {
color: #333;
text-decoration: underline;
cursor: pointer;
transition: color 0.3s;
} .content-replacer-container ul li a:hover {
color: #ffba00;
}
duola.php
WordPress产品导入后内容出现乱码,以及附属一些别的功能的更多相关文章
- ajax 一个 gbk 目标后内容乱码的解决方案
ajax 一个 gbk 目标后,如果内容出现乱码,说明服务器在送出内容时没有指定 charset,ajax 对于没有指定 charset 的 response 默认以 utf-8 来处理,所有出现乱码 ...
- (视频) 《快速创建网站》 3.1 WordPress 数据导入
本文是<快速创建网站>系列的第5篇,如果你还没有看过之前的内容,建议你点击以下目录中的章节先阅读其他内容再回到本文. 访问本系列目录,请点击:http://devopshub.cn/tag ...
- mysql导入sql文件,乱码,一个例子
服务器centos,其他数据库都是utf8都正常能用 网页正常显示 这次导入一个utf8格式数据库文件 结果网页上乱码 在导出的sql文件中,注释部分有些语句也是被mysql考虑的.导出的sql文件, ...
- [转]mysql导入导出数据中文乱码解决方法小结
本文章总结了mysql导入导出数据中文乱码解决方法,出现中文乱码一般情况是导入导入时编码的设置问题,我们只要把编码调整一致即可解决此方法,下面是搜索到的一些方法总结,方便需要的朋友. linux系统中 ...
- 关于Oracle字符集在dmp文件导入导出中的乱码影响
Oracle 在进行dmp备份和还原的时候,服务器端字符集和客户端字符集会对这个过程有较大影响,特别是数据表中存储了中文.存储过程中使用了中文编码(注释)的时候,如果没有处理好字符集的问题,在进行还原 ...
- 解决NavicatPremium导入CSV文件中文乱码的问题
在做数据对接导入的时候对方提供的数据是CSV格式的文件 一开始用Excel打开时发现格式就不对,后来发现只要用Excel打开,就会破坏里面的格式 然后想先用NaviCat导入CSV再转成Excel格式 ...
- Jmeter响应内容显示乱码问题的解决办法
Jmeter在访问接口的时候,响应内容如果有中文可能会显示乱码,原因应该是响应页面没有做编码处理,jmeter默认按照ISO-8859-1编码格式进行解析. 下面把解决步骤列一下: 现象:jmeter ...
- 从phpMyAdmin批量导入Excel内容到MySQL(亲测非常简洁有效)
今天做项目遇到需要用phpMyAdmin批量导入Excel内容到MySQL数据库.分析了我的踏坑经历并且总结一最便捷的一套导入数据的方法,非常实用简洁: 1.修改Excel表的数据,使得Excel中的 ...
- 【转】从phpMyAdmin批量导入Excel内容到MySQL(亲测非常简洁有效)
今天做项目遇到需要用phpMyAdmin批量导入Excel内容到MySQL数据库.分析了我的踏坑经历并且总结一最便捷的一套导入数据的方法,非常实用简洁: 1.修改Excel表的数据,使得Excel中的 ...
- IDEA集成Docker插件后出现日志乱码的解决办法
修改IDEA的vmoptions文件 找到IDEA安装目录的bin目录,在idea.exe.vmoptions和idea64.exe.vmoptions文件中追加以下内容: -Dfile.encodi ...
随机推荐
- 系统框架(delphi)
写了一个简单的框架,参考ERP系统写的,可使用两层(client+DB),或三层(client+app<datasnap>+DB)的方式运行,非com+方式. 哈哈,登录好俗...... ...
- CSP-S2024 游记
CSP-S2024 游记 Day 0 晚上放假回家了,宵夜整了点麦当当,就去睡了. Day 1 本来想多睡会,结果到 \(7:10\) 惊醒了,发现为防止早读迟到已经进化出自动起床功能了. 准备睡回笼 ...
- mysql 批量重命名数据表、统一给表加前缀
背景 一个本地数据库,里面有 90 个数据表.由于历史原因,现在需要批量给以前的数据表加上一个前缀.于是安排人吭哧吭呲的人工修改,耗费一天工时.过了几天,又需要把统一前缀去掉.内心早已问候 @¥#%% ...
- python的egg的制作
egg包是目前最流行的python应用打包部署方式.如何制作和安装egg包?下面我就简单的分析了一下. 总是安装别人的egg包,是不是也想制作自己的egg包呢?好,接下来我们就自己制作一个简单的egg ...
- 记一次 .NET某差旅系统 CPU爆高分析
一:背景 1. 讲故事 前些天训练营里的一位学员找到我,说他们的差旅后台系统出现了CPU爆高的情况,爆高之后就下不去了,自己分析了下也没找到原因,事情比较紧急,让我帮忙看下是什么回事,手里也有dump ...
- AE错误代码
错误代码 错误描述 错误名称 HRESULT:0x80040201 "Failed to load a resource (string, icon, bitmap, etc)." ...
- uniapp权限判断
写法如下 // 检查是否有写入外部存储的权限 function writeExternalStoragePermission() { return new Promise((resolve, reje ...
- \r,\n,\r\n的前世今生
前情 最近在逛论坛的时候遇到有人在提问题,为什么\n在苹果手机上不换行,我以前有网上看到过文章,是因为各系统的解析不同,需要使用\r\n来做兼容,自己虽然知道怎么解决,但是不知具体原因,今特来详细了解 ...
- vs2017 opencv 编译错误 error C2665: “exp”: 3 个重载中没有一个可以转换所有参数类型
编译错误 - error C2665: "exp": 3 个重载中没有一个可以转换所有参数类型,在GenericPacketMath.h文件, 是因为使用了Eigen3.4库,只要 ...
- CentOS8 Failed to start docker.service: Unit docker.service not found处理方式
出现该问题的原因是 centos8 中的podman导致的,podman是centos8预装的类似docker的软件 不需要所以直接卸载. 解决方式: dnf remove podman 然后重装D ...