WordPress 页面免密钥插入地图

WordPress 页面免密钥插入地图

我们在 WordPress 建站场景应用中很多时候会用到地图功能,来介绍区位以便更好更直观的标识某个位置的所在地。最简单的方法就是直接把地标位置在地图中截图,以图片的形式展示出来。但这种方法似乎对用户不太友好,不能互动。在奶爸建站的QQ群(群号:774633089)里有个网友问过能不能在WordPress中插入地图,我当时的回答是可以,利用地图API就行。自己也没去深究这个问题,今天没事就看了看,对比了百度地图、高德地图、腾讯地图,引用的时候基本都需要注册账号,然后申请 key ,引用都很麻烦,这里简绍一个不需要密钥的 api —— 高德地图。

获取高德地图引用代码

打开高德地图生成器:https://lbs.amap.com/console/show/tools,按步骤创建地图,功能很丰富。
WordPress 页面免密钥插入地图
可以编辑地图样式,按照自己的喜好修改地图的外观,地图的宽和高、地图上显示的按钮(缩放、缩略图、比例尺)、鼠标和键盘对地图的操作等,一般默认即可。
WordPress 页面免密钥插入地图
设置好后点击“获取代码”按钮,生成地图引用代码。

生成引用地图 HTML 文件

把上一步生成的代码保存为一个 HTML 文件,如 amap.html,我们把它上传到网站的根目录下,在浏览器中打开,就可以看到自己定义的高德地图了。

将地图插入 WordPress 页面中

打开你想要插入地图的页面,输入以下代码。(如果你使用的古腾堡编辑器,更改区块格式为“自定义HTML”)

这样我们就吧地图嵌入到网页中了,当然地图的宽高、在网页中显示的位置可自己写CSS调整,也可简单地像我只调整宽和高。

在 amap.html 文件中将 width:600px 修改为 width:100%,如下:

.my-map { margin: 0 auto; width: 100%; height: 600px; }

在页面的引用中,也作相应调整,如下:

搞定,如果你想更进一步,自己慢慢琢磨。官方也给出了各种主题样式,请移步

WordPress图片上传自动重命名

[info]正常情况下WordPress在上传图片时候,文件名是什么上传之后就是什么。随着时间推移,图片越来越多,难免会出现重复。最新上传的文件,就会替代院线的文件,造成不必要的麻烦。而且WordPress图片上传对中文文件名不太友好,有时候会无法正常显示。我们可以让上传的文件都自动重命名,来解决这个麻烦![/info]

一、根据上传时间重命名文件

add_filter('wp_handle_upload_prefilter', 'custom_upload_filter' );
function custom_upload_filter( $file ){
	$info = pathinfo($file['name']);
	$ext = $info['extension'];
	$filedate = date('YmdHis').rand(10,99);//为了避免时间重复,再加一段2位的随机数
	$file['name'] = $filedate.'.'.$ext;
    return $file;
}

二、使用md5转码文件名

add_filter('wp_handle_upload_prefilter', 'custom_upload_filter' );
function custom_upload_filter( $file ){
	$info = pathinfo($file['name']);
	$ext = '.' . $info['extension'];
	$md5 = md5($file['name']);
    $file['name'] = $md5.$ext;
    return $file;
}

我们可以选择其中一个办法添加到当前主题functions.php文件中,以后添加附件、图片的时候就会自动重命名。

控制 WordPress 文章的发布间隔时间

有时候大家发布文章的时候可能是一有时间就会连着发布好几篇,但每篇文章的发布时间有一定时间间隔或许更适合读者。实现方法很简单,如下:

将代码添加到当前主题的 functions.php 文件中:

//设定每篇文章的发布间隔
function force_time_between_posts($data, $postarr) {
global $wpdb;
if (empty($postarr['ID'])) return $data;
$latest = $wpdb->get_var("
SELECT post_date
FROM {$wpdb->posts} 
WHERE post_status IN('future','publish') 
AND post_type = 'post' 
AND ID != {$postarr['ID']}
ORDER BY post_date DESC
LIMIT 1");
$distance = 60; // 时间间隔(分钟)
$latest = strtotime($latest);
$current = strtotime($data['post_date']);
if ($latest < $current) {
$diff = $current - $latest;
} else { 
$diff = 0;
}
if ($diff >= 0 && $diff < ($distance * 60)) {
$new_date = $latest + ($distance * 60);
$date = date('Y-m-d H:i:s',$new_date);
$date_gmt = get_gmt_from_date($date);
$data['post_date'] = $date;
$data['post_date_gmt'] = $date_gmt;
$data['post_status'] = 'future';
}
return $data;
}
add_action('wp_insert_post_data','force_time_between_posts',1,2);

发布新文章时,会自动检测上一篇文章的发布时间,如果超过60分钟,就直接发布,如果小于60分钟,就自动定时间隔60分钟发布。需要注意的是,所检测的是所有已发布和定时发布的文章中的最后一篇。

WordPress 根据访问设备使用不同的主题

根据访问设备的不同,区分开浏览器版本和PC与移动端,代码如下:

function ws_switch_theme($theme){
    global $is_IE;
    if($is_IE){
        preg_match('/MSIE\s(\d)\.0;/', $_SERVER['HTTP_USER_AGENT'], $matches);
        $IEversion = $matches[1];
        if($IEversion=6){
            $theme='twentyten';//IE 6 
        }
        if($IEversion=7){
            $theme='twentyeleven';//IE 7
        }
        if($IEversion=8){
            $theme='twentytwelve';//IE 8
        }
    }
    if(wp_is_mobile()) {
        $theme='twentytwelve';//移动端
    }
    return $theme;
}
add_filter( 'template', 'ws_switch_theme' );
add_filter( 'stylesheet', 'ws_switch_theme' );

你可以根据上面的代码自行修改,在何种设备访问时加载什么主题。注意主题名字一定是主题文件夹名字,而不是后台管理界面你看到的主题名字。
请勿直接添加到主题的 functions.php 中,无法生效。

使用方法:

1.在 Code Snippets 插件 中添加此段代码
插件下载地址:https://tw.wordpress.org/plugins/code-snippets/

2.把代码写成插件,安装!(反正我是不会,有能力的自己去写吧!)

免插件实现 WordPress 文章自动添加标签

将以下代码粘贴到 function.php 中:

// WordPress 自动为文章添加已使用过的标签
function array2object($array) { // 数组转对象
  if (is_array($array)) {
    $obj = new StdClass();
    foreach ($array as $key => $val){
      $obj->$key = $val;
    }
  }
  else {
    $obj = $array;
  }
  return $obj;
}
function object2array($object) { // 对象转数组
  if (is_object($object)) {
    foreach ($object as $key => $value) {
      $array[$key] = $value;
    }
  }
  else {
    $array = $object;
  }
  return $array;
}
add_action('save_post', 'auto_add_tags');
function auto_add_tags(){
  $tags = get_tags( array('hide_empty' => false) );
  $post_id = get_the_ID();
  $post_content = get_post($post_id)->post_content;
  if ($tags) {
    $i = 0;
    $arrs = object2array($tags);shuffle($arrs);$tags = array2object($arrs);// 打乱顺序
    foreach ( $tags as $tag ) {
    // 如果文章内容出现了已使用过的标签,自动添加这些标签
      if ( strpos($post_content, $tag->name) !== false){
        if ($i == 5) { // 控制输出数量
          break;
        }
        wp_set_post_tags( $post_id, $tag->name, true );
        $i++;
      }
    }
  }
}

WordPress 评论添加验证码

垃圾评论是无法避免的,一般可以开启评论审核不让垃圾评论第一时间显示,但这并不能阻断垃圾评论的产生。所以我们需要验证码防止机器人评论广告信息,不用安装任何插件就能现实验证码功能。

将代码添加到当前主题的 functions.php 中:

一:数字加法两个随机数验证码

function loper_protection_math(){
# 数字加法两个随机数, 范围0~99
$num1=rand(0,9);
$num2=rand(0,9);
echo "<input type=\"text\" name=\"sum\" class=\"text\" value=\"\" size=\"25\" tabindex=\"4\" placeholder=\"$num1 + $num2 = ?\" >\n";
echo "<input type=\"hidden\" name=\"num1\" value=\"$num1\">\n";
echo "<input type=\"hidden\" name=\"num2\" value=\"$num2\">";
echo "<label for=\"math\">请输入(计算结果)</label>\n";
}
function loper_protection_pre($commentdata){
$sum=$_POST['sum'];
switch($sum){
case $_POST['num1']+$_POST['num2']:
break;case null:err('错误: 请输入验证码。');
break;default:err('错误: 验证码错误。');}
return $commentdata;}
if($comment_data['comment_type']==''){
add_filter('preprocess_comment','loper_protection_pre');}

二:英文数字随机数验证码

function loper_protection_math(){
$num1=substr(md5(mt_rand(0,99)),0,5);
# 英文数字随机数, 范围0~99
echo "<input type=\"text\" name=\"sum\" class=\"text\" value=\"\" size=\"25\" tabindex=\"4\">\n";
echo "<input type=\"hidden\" name=\"num1\" value=\"$num1\">\n";
echo "<label for=\"math\" >请输入( $num1 )</label>\n";
}
function loper_protection_pre($commentdata){
$sum=$_POST['sum'];
switch($sum){
case $_POST['num1']:
break;case null:err('错误: 请输入验证码。');
break;default:err('错误: 验证码错误。');}
return $commentdata;}
if($comment_data['comment_type']==''){
add_filter('preprocess_comment','loper_protection_pre');}

调用代码:

WordPress实用functions.php代码集

 

100个,有点飘了。努力做到啊!收集一些比较实用,只需要插入 functions.php 就能实现功能的代码。大家可以在页面使用 CTRL+F 进行查找,以下代码本站未全部测试,使用前请做好备份。如有代码错误,请及时留言。

推荐阅读:WordPress高效正确的管理 functions.php 文件

1、实现侧边栏文本工具运行PHP代码

add_filter('widget_text', 'php_text', 99);
function php_text($text) {
if (strpos($text, '<' . '?') !== false) {
ob_start();
eval('?' . '>' . $text);
$text = ob_get_contents();
ob_end_clean();
}
return $text;
}

2、禁用 Gutenberg(古腾堡) 编辑器

add_filter('use_block_editor_for_post', '__return_false');
remove_action( 'wp_enqueue_scripts', 'wp_common_block_scripts_and_styles' );

3、指定分类不在首页显示

function exclude_category_home( $query ) {
if ( $query->is_home ) {
$query->set( 'cat', '-20, -22' ); //你要排除的分类ID
}
return $query;
}
add_filter( 'pre_get_posts', 'exclude_category_home' );

4、搜索结果排除指定文章或页面

function wpsite_search_filter_id($query) {
if ( !$query->is_admin && $query->is_search) {
$query->set('post__not_in', array(40,819));
//文章或者页面的ID
}
return $query;
}
add_filter('pre_get_posts','wpsite_search_filter_id');

5、搜索结果排除指定类别的文章

function wpsite_search_filter_category( $query) {
if ( !$query->is_admin && $query->is_search) {
$query->set('cat','-15,-57');
//分类的ID,减号表示排除;直接写ID,则表示只在该分类ID中搜索
}
return $query;
}
add_filter('pre_get_posts','wpsite_search_filter_category');

6、搜索结果排除所有页面

function search_filter_page($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','search_filter_page')

7、禁止版本、插件、主题自动更新和检查

// 彻底关闭自动更新
add_filter('automatic_updater_disabled', '__return_true');
// 关闭更新检查定时作业
remove_action('init', 'wp_schedule_update_checks');
// 移除已有的版本检查定时作业
wp_clear_scheduled_hook('wp_version_check');
// 移除已有的插件更新定时作业
wp_clear_scheduled_hook('wp_update_plugins');
// 移除已有的主题更新定时作业 
wp_clear_scheduled_hook('wp_update_themes');
// 移除已有的自动更新定时作业 
wp_clear_scheduled_hook('wp_maybe_auto_update');
// 移除后台内核更新检查 
remove_action( 'admin_init', '_maybe_update_core' );
// 移除后台插件更新检查 
remove_action( 'load-plugins.php', 'wp_update_plugins' );
remove_action( 'load-update.php', 'wp_update_plugins' );
remove_action( 'load-update-core.php', 'wp_update_plugins' );
remove_action( 'admin_init', '_maybe_update_plugins' );
 // 移除后台主题更新检查 
remove_action( 'load-themes.php', 'wp_update_themes' );
remove_action( 'load-update.php', 'wp_update_themes' );
remove_action( 'load-update-core.php', 'wp_update_themes' );
remove_action( 'admin_init', '_maybe_update_themes' );

8、文章的段落首行自动缩进(空两格)

function Bing_text_indent($text){
$return = str_replace('<p', '<p style="text-indent:2em;"',$text);
return $return;
}
add_filter('the_content','Bing_text_indent');

9、去除评论中链接/日期时间/网站

// 删除评论中的链接
function mytheme_remove_url($arg) {
$arg['url'] = '';
return $arg;
}
add_filter('comment_form_default_fields', 'mytheme_remove_url');
// 删除评论日期时间
function wpb_remove_comment_date($date, $d, $comment) {
if ( !is_admin() ) {
return;
} else {
return $date;
}
}
add_filter( 'get_comment_date', 'wpb_remove_comment_date', 10, 3);
// remove comment time
function wpb_remove_comment_time($date, $d, $comment) {
if ( !is_admin() ) {
return;
} else {
return $date;
}
}
//删除评论者的网站
function disable_comment_author_links( $author_link ){
return strip_tags( $author_link );
}
add_filter( 'get_comment_author_link', 'disable_comment_author_links' );

10、去掉分类页标题中的“分类”字样

注意:这里去掉的不是链接中的 category 

add_filter( 'get_the_archive_title', function ( $title ) {
if( is_category() ) {
$title = single_cat_title( '', false );
}
return $title;
});

11、评论必须含中文

function refused_spam_comments( $comment_data ) { 
$pattern = '/[一-龥]/u'; 
if(!preg_match($pattern,$comment_data['comment_content'])) { 
err('评论必须含中文!'); 
} 
return( $comment_data ); 
} 
add_filter('preprocess_comment','refused_spam_comments');

12、屏蔽后台“显示选项”和“帮助”选项卡

function remove_screen_options(){ return false;}
add_filter('screen_options_show_screen', 'remove_screen_options');
add_filter( 'contextual_help', 'wpse50723_remove_help', 999, 3 );
function wpse50723_remove_help($old_help, $screen_id, $screen){
$screen->remove_help_tabs();
return $old_help;
}

13、屏蔽后台页脚版本信息

function change_footer_admin () {return '';}
add_filter('admin_footer_text', 'change_footer_admin', 9999);
function change_footer_version() {return '';}
add_filter( 'update_footer', 'change_footer_version', 9999);

14、隐藏左上角WordPress标志

function hidden_admin_bar_remove() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wp-logo');
}
add_action('wp_before_admin_bar_render', 'hidden_admin_bar_remove', 0);

15、去除后台标题中的“- WordPress”

add_filter('admin_title', 'zm_custom_admin_title', 10, 2);
function zm_custom_admin_title($admin_title, $title){
return $title.' &lsaquo; '.get_bloginfo('name');
}

16、去除登录标题中的“- WordPress”

add_filter('login_title', 'zm_custom_login_title', 10, 2);
function zm_custom_login_title($login_title, $title){
return $title.' &lsaquo; '.get_bloginfo('name');
}

17、上传文件重命名(按时间)

function git_upload_filter($file) {
$time = date("YmdHis");
$file['name'] = $time . "" . mt_rand(1, 100) . "." . pathinfo($file['name'], PATHINFO_EXTENSION);
return $file;
}
add_filter('wp_handle_upload_prefilter', 'git_upload_filter');

18、修改作者存档页面 Author 前缀

add_action('init', 'wenshuo_change_author_base');
function wenshuo_change_author_base() {
global $wp_rewrite;
$author_slug = 'user'; // 更改前缀为 user
$wp_rewrite->author_base = $author_slug;
}

19、限制文章评论的内容

add_action('preprocess_comment','yundanran_preprocess_comment');
function yundanran_preprocess_comment($commentdata){
$comment_post_ID = $commentdata["comment_post_ID"];
$comment_content = $commentdata["comment_content"];
$comment_author = $commentdata["comment_author"];
$comment_author_email = $commentdata["comment_author_email"];
$comment_author_url = $commentdata["comment_author_url"];
$comment_author_IP = $commentdata["comment_author_IP"];
$comment_agent = $commentdata["comment_agent"];
// 验证合法
$nonce = wp_create_nonce($comment_post_ID);
if(!isset($_POST["comment_nonce"]) || $_POST["comment_nonce"] !== $nonce){
wp_die("请勿恶意评论!");
}
// 必须输入中文
if(!preg_match("/[\x{4e00}-\x{9fa5}]+/u",$comment_content)){
wp_die("请说中国话!");
}
// 是否在黑名单
if( wp_blacklist_check($comment_author,$comment_author_email,$comment_author_url, $comment_content, $comment_author_IP, $comment_agent )){
wp_die("您已被禁止评论!");
}
// 是否登录
if(!is_user_logged_in()){
wp_die("您必须登录之后才能评论!");
}
// 过滤HTML标签
$comment_content=strip_tags($comment_content);
return $commentdata;
}

20、记录和显示会员最后登录的时间

add_action('wp_login','user_last_login'); 
function user_last_login($login) {
global $user_ID;
$user = get_user_by('id', $user_ID);
update_user_meta($user->ID, 'last_login', date('Y-m-d H:i:s'));
}

在需要显示的地方插入:

global $userdata;
get_currentuserinfo();
get_user_meta($userdata->ID, 'last_login');

21、文章中的 URL 自动加超链接

add_filter('the_content', 'make_clickable');

22、文章分类按照 ID 排序

function get_post_cat(){
global $post;
$cat_arr = get_the_category($post->ID);
$new_cat = array();
$cat_count = count($cat_arr);
for($i=0; $i<$cat_count; $i++){
for($j=$cat_count-1; $j>$i; $j--){
if($cat_arr[$i]->term_id > $cat_arr[$j]->term_id){
$tem_cat = $cat_arr[$i];
$cat_arr[$i] = $cat_arr[$j];
$cat_arr[$j] = $tem_cat;
}
}
}
return $cat_arr;
}

在需要显示的地方插入调用:

echo get_post_cat()

23、移除无效的 WP-Cron 定时任务

add_action('wpjam_remove_invild_crons', 'wpjam_remove_invild_crons');
function wpjam_remove_invild_crons(){
global $wp_filter;
$wp_crons = _get_cron_array();
foreach ($wp_crons as $timestamp => $wp_cron) {
foreach ($wp_cron as $hook => $dings) {
if(emptyempty($wp_filter[$hook])){
foreach( $dings as $sig=>$data ) {
wp_unschedule_event($timestamp, $hook, $data['args']);
}
}
}
}
}
if(!wp_next_scheduled('wpjam_remove_invild_crons')) {
wp_schedule_event( time(), 'daily', 'wpjam_remove_invild_crons' );
}

24、禁止英文单双引号自动转换成中文全角

remove_filter('the_content', 'wptexturize');

25、禁止评论中的网址自动转换为超链接

remove_filter( 'comment_text', 'make_clickable', 9 );

 

未完待续...正在整理,欢迎补充!

WordPress 搜索结果只有一篇时自动定向到文章

要实现这样的功能,有两个方法:

一、添加自定义 HOOK

将下面的代码添加到主题中 functions.php 文件里:

add_action('template_redirect', 'wj_redirect_single_post');
function wj_redirect_single_post() {
if (is_search()) {
global $wp_query;
if ($wp_query->post_count == 1) {
wp_redirect( get_permalink( $wp_query->posts['0']->ID ) );
}
}
}

二、直接修改搜索模板文件(不推荐)

在 loop 循环里面添加以下代码:

if (is_search()) {
global $wp_query;
if ($wp_query->post_count == 1) {
wp_redirect( get_permalink( $wp_query->posts['0']->ID ) );
}
}

修改WordPress注册用户默认角色名称

WordPress 中默认的用户角色有5种,订阅者、投稿者、作者、编辑、管理员,默认这些名称是不能从后台直接修改的。下面我们以修改“订阅者”为例:

将下面的代码添加到 WordPress 主题的 function.php 文件中。

function wps_change_role_name() {
global $wp_roles;
if ( !isset( $wp_roles ) )
$wp_roles = new WP_Roles();
$wp_roles->roles['subscriber']['name'] = '注册会员';
$wp_roles->role_names['subscriber'] = '注册会员';
}
add_action('init', 'wps_change_role_name');

默认权限介绍及用户权限:

  • 订阅者(subscriber):只允许修改自己的个人资料,例如昵称、联系方式、密码等等。
  • 投稿者(contributor ):具有订阅者的所有权限。可以发表或删除自己的文章,但所发文章需经管理员审核后才能在博客上显示。可以编辑处于待审中的文章,但对已通过审核的文章不能编辑。也可以查看所有站内评论,但不能对评论进行编辑。
  • 作者(author):具有投稿者的所有权限。所发表的文章无需管理员审核即可显示,还可以编辑已通过审核的文章,并且拥有媒体库的使用权限。
  • 编辑(editor ):具有作者的所有权限。可以对文章、标签、分类、页面、友情链接、评论进行管理,也可以编辑待审中的文章,但编辑后仍然处于待审状态。实际上,编辑拥有除外观、插件、用户、设置和备份之外所有后台选项的操作权限。
  • 管理员(administrator ):是wordpress最重要的角色,也是最高管理者,拥有博客后台的所有操作权限,通常该角色是唯一的。

WordPress上传webp格式的图片

什么是webp就不做介绍了,直接说方法吧!

修改 WordPress 目录 /wp-includes/functions.php 文件 注意不是主题下的 functions.php

1.搜索 'image/jpeg' => 'jpg', 在下一行加入'image/webp' => 'webp',

2.搜索 'jpg|jpeg|jpe' => 'image/jpeg', 在下一行加入'webp' => 'image/webp',

现在你就可以上传webp格式的图片了,但你会发现媒体库的文件无法预览。接下来继续修改:

主题的 functions.php 里添加以下代码:

function bzg_file_is_displayable_image($result, $path) {
$info = @getimagesize( $path );
if($info['mime'] == 'image/webp') {
$result = true;
}
return $result;
}
add_filter( 'file_is_displayable_image', 'bzg_file_is_displayable_image', 10, 2 );

修改完毕!

相关拓展

1.Photoshop 如何导出webp格式的图片

安装 PhotoShop WebPFormat 插件(下载 WebPFormat ),将WebPFormat.dmg(Mac)或者WebPFormat.8bi(Windows)复制粘贴至PhotoShop安装目录内的Plug-ins插件文件夹,重新启动PS。

2.如何直接保存网页中的图片为webp格式

安装Chrome插件:图片另存为JPG/PNG/WebP

3.Windows / Mac 怎么预览webp图片,当然是安装WebP插件,点击下载

WordPress 拥抱 MarkDown

 
MarkDown 使用的人现在是越来越多了,对于写作来说 MarkDown 无疑是最好的选择。但 WordPress 并没想加入 MarkDown 语法支持的想法,只能自己动手改一下了。

1.Parsedown Github项目地址: https://github.com/erusev/parsedown/releases/

2.在主题目录下新建一个目录 extend

3.将 Parsedown.php 放到 extend 目录

4.将下面的代码添加到主题目录的 functions.php

function wp_parsedown(){
include_once(get_stylesheet_directory()."/extend/Parsedown.php");
$Parsedown = new Parsedown();
$content = get_the_content();
$content = $Parsedown->text($content);
if(is_single() || is_page()){
echo $content;
}
else{
$content = strip_tags($content);
$content = mb_substr($content,0,180,'UTF-8');
echo $content;
}
}
add_action('the_content','wp_parsedown');

最后在写作的时候切换到文本模式就可以是用 MarkDown 语法了。

WordPress 所有外链在新标签打开

将下面的代码添加到主题的 function.php 中

function rt_add_link_target( $content ){
// use the  tag to split into segments
$bits = explode( '$bit ){
// fix the target="_blank" bug after the link
if ( strpos( $bit, 'href' ) === false ) continue;
// find the end of each link
$pos = strpos( $bit, '>' );
// check if there is an end (only fails with malformed markup)
if( $pos !== false ){
// get a string with just the link's attibutes
$part = substr( $bit, 0, $pos );
// for comparison, get the current site/network url
$siteurl = network_site_url();
// if the site url is in the attributes, assume it's in the href and skip, also if a target is present
if( strpos( $part, $siteurl ) === false && strpos( $part, 'target=' ) === false ){
// add the target attribute
$bits[$key] = 'target="_blank" ' . $bits[$key];
}
}
}
// re-assemble the content, and return it
return implode( '
退出移动版