转载说明:原创不易,未经授权,谢绝任何形式的转载
占位符属性通常用于在文本输入框中添加提示文本,或作为适当标签的替代。
2025年07月20日
转载说明:原创不易,未经授权,谢绝任何形式的转载
占位符属性通常用于在文本输入框中添加提示文本,或作为适当标签的替代。
2025年07月20日
在数字化时代,网站数据分析是企业优化用户体验、提升转化率的关键。然而,主流分析工具(如Google Analytics)存在两大痛点:
2025年07月20日
宝塔安装系统软件:Nginx 、MySQL5.1+、PHP( PHP用7.1-7.4版本)、phpMyAdmin(Web端MySQL管理工具)。
2025年07月20日
今天安利的一套在线视频播放源码,它不是安卓端,也不是PC端。你只需要部署一下这个单页面源码即可。
使用php+mysql+nginx即可。任何版本都能运行。
网页打开服务器地址:10008 用户:admin 密码:admin
首页如图
使用方法为先搜索你想看的影片或者电视剧又或者其他视频都可以。
这里我们随便搜索一个
2025年07月20日
最近有个做灯具外贸的客户半夜紧急call我,一开口就带着哭腔:"我的网站首页被换成了一堆乱码,还弹赌博广告!" 我连夜帮他排查,发现黑客是通过/wp-admin后台爆破进来的——这老哥居然用"admin+123456"这种祖传密码...
2025年07月20日
Selenium 是最广泛使用的开源 Web UI(用户界面)自动化测试套件之一。Selenium 支持的语言包括C#,Java,Perl,PHP,Python 和 Ruby。目前,Selenium Web 驱动程序最受 Python 和 C#欢迎。Selenium测试脚本可以使用任何支持的编程语言进行编码,并且可以直接在大多数现代 Web 浏览器中运行。在爬虫领域 selenium 同样是一把利器,能够解决大部分的网页的反爬问题。主要用于自动化测试、爬虫模拟人操作浏览器。
2025年07月20日
QuasiBot是一款php编写的webshell管理工具,可以对webshell进行远程批量管理。这个工具超越于普通的webshell管理是因为其还拥有安全扫描、漏洞利用测试等功能,可以帮助渗透测试人员进行高效的测试工作。
QuasiBot是如何工作的
quasiBot 支持对webshell进行远程操作,每一个webshell都会通过md5 hash验证并且每小时替换一次
quasiBot (C&C) -[请求/验证]-> Bots (Webshells) -[响应/验证]-> quasiBot (C&C) -[请求/命令]-> Bots (Webshells) -[响应/执行]-> quasiBot (C&C)
2025年07月18日
作为程序员,天天跟电脑和代码打交道,有时候就需要一些工具来提升我们的效率。下面介绍一些 Windows 系统上发现的一些好用的工具,工作效率up。
啥都别说了,ServBay必须排在第一个。作为Web开发者,这个工具可太必要了。
对于Web开发者来说,在本地电脑上配置和管理Python、Node.jsPHP、MySQL、Nginx等开发环境是一件比较繁琐的事。ServBay是一个集成了这些常用服务的工具,它提供了一个图形化界面,让你能够方便地启动、停止和切换不同版本的服务,不仅如此,而且它还支持SSL证书,在开发过程中省去了大量手动配置的时间,这样我就可以更专注于开发工作本身。
2025年07月18日
客户要求php的,原本打算layui + laravel,各种原因还是选了 la admin。
之前试了 la admin2.0的版本,竟然没有权限管理
系统后台有个手动充值表单,需要弹窗,结果选择商品套餐不能联动,找了github上的issue帖子,也没搞定。
2025年07月18日
<?php
/**
* @package 产品模块22
* @version 1.0.0
* Plugin Name: Schoolo_cn 产品自定义字段模块
* Plugin URI: http://wordpress.org/plugins/schoolo-product/
* Description: 外贸站产品模块,包含产品自定义文章类型、元框字段、分类法及扩展功能
* Author: 小胖同学
* Version: 1.0.0
* Author URI: https://ai.schoolo.cn
*/
if (!defined('ABSPATH')) {
exit; // 禁止直接访问
}
// 定义插件常量
define('SCHOOLO_PRODUCT_VERSION', '1.0.0');
define('SCHOOLO_PRODUCT_DIR', plugin_dir_path(__FILE__));
define('SCHOOLO_PRODUCT_URL', plugin_dir_url(__FILE__));
/**
* 安全注册产品自定义文章类型
*/
add_action('init', 'schoolo_register_product_post_type', 10);
function schoolo_register_product_post_type() {
if (post_type_exists('product')) {
error_log('警告:product 文章类型已存在,注册跳过');
return;
}
$labels = [
'name' => _x('产品', 'post type general name', 'schoolo-product'),
'singular_name' => _x('产品', 'post type singular name', 'schoolo-product'),
'menu_name' => __('产品', 'schoolo-product'),
'all_items' => __('所有产品', 'schoolo-product'),
'add_new' => __('添加新产品', 'schoolo-product'),
'add_new_item' => __('新建产品', 'schoolo-product'),
'edit_item' => __('编辑产品', 'schoolo-product'),
'view_item' => __('查看产品', 'schoolo-product'),
'search_items' => __('搜索产品', 'schoolo-product'),
'not_found' => __('未找到产品', 'schoolo-product'),
'not_found_in_trash' => __('回收站无产品', 'schoolo-product'),
'featured_image' => __('产品封面图', 'schoolo-product'),
'set_featured_image' => __('设置封面图', 'schoolo-product'),
];
$args = [
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_admin_bar' => true,
'query_var' => true,
'rewrite' => ['slug' => 'product', 'with_front' => false],
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => 5,
'menu_icon' => 'dashicons-products',
// 'supports' => ['title', 'editor', 'thumbnail', 'excerpt', 'custom-fields'],
'supports' => array( 'title', 'editor', 'author','excerpt', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields'/* , 'page-attributes' */, 'post-formats', ),
'show_in_rest' => true,
'map_meta_cap' => true,
'taxonomies' => ['product_category', 'product_tag'],
];
$result = register_post_type('product', $args);
if (is_wp_error($result)) {
error_log('产品文章类型注册失败:' . $result->get_error_message());
} else {
error_log('产品文章类型注册成功');
}
}
/**
* 注册产品分类法
*/
add_action('init', 'schoolo_register_product_taxonomies', 10);
function schoolo_register_product_taxonomies() {
// 注册产品分类
if (!taxonomy_exists('product_category')) {
$labels = [
'name' => _x('产品分类', 'taxonomy general name', 'schoolo-product'),
'singular_name' => _x('分类', 'taxonomy singular name', 'schoolo-product'),
'search_items' => __('搜索分类', 'schoolo-product'),
'all_items' => __('所有分类', 'schoolo-product'),
'parent_item' => __('父级分类', 'schoolo-product'),
'menu_name' => __('产品分类', 'schoolo-product'),
];
register_taxonomy('product_category', ['product'], [
'labels' => $labels,
'hierarchical' => true,
'show_ui' => true,
'show_in_rest' => true,
'rewrite' => ['slug' => 'product-category'],
]);
}
// 注册产品标签
if (!taxonomy_exists('product_tag')) {
$labels = [
'name' => _x('产品标签', 'taxonomy general name', 'schoolo-product'),
'singular_name' => _x('标签', 'taxonomy singular name', 'schoolo-product'),
'search_items' => __('搜索标签', 'schoolo-product'),
'all_items' => __('所有标签', 'schoolo-product'),
'menu_name' => __('产品标签', 'schoolo-product'),
];
register_taxonomy('product_tag', ['product'], [
'labels' => $labels,
'hierarchical' => false,
'show_ui' => true,
'show_in_rest' => true,
'show_in_nav_menus' => true,
'show_admin_column' => true, // 可选:在文章列表显示分类列
'rewrite' => ['slug' => 'product-tag'],
]);
}
}
/**
* 加载 CMB2 插件(若未安装)
*/
if (!class_exists('CMB2')) {
require_once SCHOOLO_PRODUCT_DIR . 'includes/cmb2/init.php'; // 假设 CMB2 路径正确
}
/**
* 产品元框字段(基于 CMB2)
*/
add_action('cmb2_admin_init', 'schoolo_product_metaboxes');
function schoolo_product_metaboxes() {
$prefix = 'schoolo_';
// 主元框:产品设置
$cmb_product = new_cmb2_box([
'id' => $prefix . 'product_metabox',
'title' => __('产品设置', 'schoolo-product'),
'object_types' => ['product'],
'context' => 'normal',
'priority' => 'high',
]);
// 产品视频(外部嵌入)
$cmb_product->add_field([
'name' => __('产品视频 (外部调用)', 'schoolo-product'),
'desc' => __('输入视频页面地址(如YouTube/Vimeo)', 'schoolo-product'),
'id' => $prefix . 'video_embed',
'type' => 'oembed',
]);
// 产品视频(本地上传)
$cmb_product->add_field([
'name' => __('产品视频 (本地上传)', 'schoolo-product'),
'desc' => __('上传视频或输入URL', 'schoolo-product'),
'id' => $prefix . 'video_url',
'type' => 'file',
'query_args' => ['type' => 'video'],
'text' => ['add_upload_file_text' => '添加视频'],
]);
$cmb_product->add_field( array(
'name' => esc_html__( '浏览次数', 'wppopMetabox' ),
'desc' => __( '统计显示当前文章的浏览量, 支持自定义修改', 'wppopMetabox' ),
'id' => 'views',
'type' => 'text_small',
) );
// 视频封面图片
$cmb_product->add_field([
'name' => __('视频封面图片', 'schoolo-product'),
'desc' => __('设置视频封面', 'schoolo-product'),
'id' => $prefix . 'video_thumb',
'type' => 'file',
'query_args' => ['type' => 'image'],
'text' => ['add_upload_file_text' => '添加图片'],
]);
// 多图上传
$cmb_product->add_field([
'name' => __('产品图片', 'schoolo-product'),
'desc' => __('上传多张图片(切换展示)', 'schoolo-product'),
'id' => $prefix . 'product_images',
'type' => 'file_list',
'query_args' => ['type' => 'image'],
'preview_size' => [100, 100],
'text' => [
'add_upload_files_text' => '添加图片',
'remove_image_text' => '移除图片',
],
]);
// 产品参数(短描述)
$cmb_product->add_field([
'name' => __('产品参数', 'schoolo-product'),
'desc' => __('自定义参数内容(显示于图片右侧)', 'schoolo-product'),
'id' => $prefix . 'product_params',
'type' => 'wysiwyg',
'options' => ['textarea_rows' => 5],
]);
$cmb_product->add_field([
'name' => __('购买链接', 'schoolo-product'),
'desc' => __('输入电商平台链接', 'schoolo-product'),
'id' => $prefix . 'purchase_url',
'type' => 'text_url',
]);
// 热门产品标记
$cmb_product->add_field([
'name' => __('热门产品', 'schoolo-product'),
'desc' => __('勾选后显示于热门产品列表', 'schoolo-product'),
'id' => $prefix . 'is_hot',
'type' => 'checkbox',
]);
// 可重复内容模块(选项卡)
$cmb_tabs = new_cmb2_box([
'id' => $prefix . 'product_tabs',
'title' => __('自定义内容模块', 'schoolo-product'),
'object_types' => ['product'],
'context' => 'normal',
]);
$group_id = $cmb_tabs->add_field([
'id' => $prefix . 'tabs_group',
'type' => 'group',
'description' => __('添加可切换内容模块(建议不超过6个)', 'schoolo-product'),
'options' => [
'group_title' => __('模块 {#}', 'schoolo-product'),
'add_button' => __('【+】添加模块', 'schoolo-product'),
'remove_button' => __('移除模块', 'schoolo-product'),
'sortable' => true,
],
]);
$cmb_tabs->add_group_field($group_id, [
'name' => __('模块标题', 'schoolo-product'),
'id' => 'tab_title',
'type' => 'text',
]);
$cmb_tabs->add_group_field($group_id, [
'name' => __('模块内容', 'schoolo-product'),
'id' => 'tab_content',
'type' => 'wysiwyg',
'options' => ['textarea_rows' => 8],
]);
}
/**
* 加载插件文本域(多语言支持)
*/
add_action('plugins_loaded', 'schoolo_product_load_textdomain');
function schoolo_product_load_textdomain() {
load_plugin_textdomain('schoolo-product', false, dirname(plugin_basename(__FILE__)) . '/languages/');
}
?>