【Android学习】简单的登录页面和业务逻辑实现

实现功能

1 登录页:密码登录和验证码登录
2 忘记密码页:修改密码
3 页面基础逻辑 java代码

基础页面

在这里插入图片描述
在这里插入图片描述

XML

login_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    >
<!--    单选框-->
    <RadioGroup
        android:id="@+id/rg_login"
        android:layout_width="match_parent"
        android:layout_height="@dimen/item_layout_height"
        android:orientation="horizontal">
        <RadioButton
            android:id="@+id/rg_password"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="match_parent"
            android:text="@string/login_by_password"
            android:textSize="@dimen/common_font_size"
            android:checked="true"/>
        <RadioButton
            android:id="@+id/rg_vertifycode"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="match_parent"
            android:text="@string/login_by_vertifycode"
            android:textSize="@dimen/common_font_size"/>
    </RadioGroup>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/item_layout_height"
        android:orientation="horizontal">
        <TextView
            android:id="@+id/tv_phone"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:gravity="center"
            android:text="@string/phone_number"
            android:textColor="@color/black"
            android:textSize="@dimen/common_font_size"/>
        <EditText
            android:id="@+id/et_phone"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="match_parent"
            android:layout_marginTop="5dp"
            android:layout_marginBottom="5dp"
            android:hint="@string/inout_phone_number"
            android:background="@drawable/editor_selector"
            android:textColor="@color/black"
            android:maxLength="11"
            android:inputType="number"
            android:textColorHint="@color/grey"
            android:textSize="@dimen/common_font_size"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/item_layout_height"
        android:orientation="horizontal">
        <TextView
            android:id="@+id/tv_password"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:gravity="center"
            android:text="@string/login_password"
            android:textColor="@color/black"
            android:textSize="@dimen/common_font_size"/>
        <RelativeLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1">
            <EditText
                android:id="@+id/et_password"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"
                android:inputType="numberPassword"
                android:hint="@string/input_password"
                android:background="@drawable/editor_selector"
                android:textColor="@color/black"
                android:maxLength="6"
                android:textColorHint="@color/grey"
                android:textSize="@dimen/common_font_size"/>
            <Button
                android:id="@+id/btn_forget"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:text="@string/forget_password"
                android:layout_alignParentEnd="true"
                android:textColorHint="@color/black"
                android:textSize="@dimen/common_font_size"
                />
        </RelativeLayout>
    </LinearLayout>
    <CheckBox
        android:id="@+id/ck_remember"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/remember_password"
        android:textColorHint="@color/black"
        android:textSize="@dimen/common_font_size"
        />
    <Button
        android:id="@+id/btn_login"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/login"
        android:textColorHint="@color/black"
        android:textSize="@dimen/btn_font_size"
        />
</LinearLayout>
login_forget_password.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    >

  <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="60dp"
      android:orientation="horizontal">
    <TextView

        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="@string/input_new_password"
        android:textColor="@color/black"
        android:textSize="@dimen/common_font_size"/>
    <EditText
        android:id="@+id/et_password_first"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:layout_marginTop="5dp"
        android:layout_marginBottom="5dp"
        android:inputType="numberPassword"
        android:hint="@string/input_new_password_hint"
        android:background="@drawable/editor_selector"
        android:textColor="@color/black"
        android:maxLength="11"
        android:textColorHint="@color/grey"
        android:textSize="@dimen/common_font_size"/>
  </LinearLayout>
  <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="60dp"
      android:orientation="horizontal">
    <TextView

        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="@string/confirm_new_password"
        android:textColor="@color/black"
        android:textSize="@dimen/common_font_size"/>
    <EditText
        android:id="@+id/et_password_second"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="match_parent"
        android:layout_marginTop="5dp"
        android:layout_marginBottom="5dp"
        android:hint="@string/confirm_new_password_again"
        android:background="@drawable/editor_selector"
        android:textColor="@color/black"
        android:maxLength="11"
        android:inputType="number"
        android:textColorHint="@color/grey"
        android:textSize="@dimen/common_font_size"/>
  </LinearLayout>
  <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="60dp"
      android:orientation="horizontal">
    <TextView

        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="@string/verifycode"
        android:textColor="@color/black"
        android:textSize="@dimen/common_font_size"/>
    <RelativeLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1">
      <EditText
          android:id="@+id/et_verifycode"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_weight="1"
          android:layout_marginTop="5dp"
          android:layout_marginBottom="5dp"
          android:inputType="numberPassword"
          android:hint="@string/input_verifycode"
          android:background="@drawable/editor_selector"
          android:textColor="@color/black"
          android:maxLength="6"
          android:textColorHint="@color/grey"
          android:textSize="@dimen/common_font_size"/>
      <Button
          android:id="@+id/btn_verificode"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:text="@string/get_verifycode"
          android:layout_alignParentEnd="true"
          android:textColorHint="@color/black"
          android:textSize="@dimen/common_font_size"
          />
    </RelativeLayout>
  </LinearLayout>
  <Button
      android:id="@+id/btn_confirm"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="@string/done"
      android:textColorHint="@color/black"
      android:textSize="@dimen/btn_font_size"
      />
</LinearLayout>

Java

loginMain.java
package com.example.learn;

import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.BlendMode;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.example.learn.utils.ViewUtil;

import java.util.Random;

public class LoginMainActivity extends AppCompatActivity implements RadioGroup.OnCheckedChangeListener, View.OnClickListener {
    private EditText et_phone;
    private TextView tv_password;
    private EditText et_password;
    private Button btn_forget;
    private CheckBox ck_remember;
    private RadioButton rg_password;
    private RadioButton rg_vertifycode;
    private ActivityResultLauncher<Intent> register;
    private Button btn_login;
    //定义固定密码 调试使用
    private String mPassword = "111111";
    private String verifyCode;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login_main);
        RadioGroup rg_login = findViewById(R.id.rg_login);
        et_phone = findViewById(R.id.et_phone);
        tv_password = findViewById(R.id.tv_password);
        et_password = findViewById(R.id.et_password);
        btn_forget = findViewById(R.id.btn_forget);
        ck_remember = findViewById(R.id.ck_remember);
        rg_password = findViewById(R.id.rg_password);
        rg_vertifycode = findViewById(R.id.rg_vertifycode);
        btn_login = findViewById(R.id.btn_login);
        //设置监听器
        rg_login.setOnCheckedChangeListener(this);
        //为电话号码、密码增加文本长度变换监听器
        et_phone.addTextChangedListener(new HideKeyboardWatch(et_phone, 11));
        et_password.addTextChangedListener(new HideKeyboardWatch(et_password, 6));
        //为忘记密码/获取验证码增加点击事件
        btn_forget.setOnClickListener(this);
       //login按钮
        btn_login.setOnClickListener(this);
        //全局registerActivityForResult
        register = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
                new ActivityResultCallback<ActivityResult>() {
                    //接收返回值
                    @Override
                    public void onActivityResult(ActivityResult result) {
                        Intent intent = result.getData();
                        if(intent!=null && result.getResultCode()==Activity.RESULT_OK){
                            mPassword = intent.getStringExtra("new_password");
                        }
                    }
                });

    }

    @Override
    public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
        switch (checkedId) {
            case R.id.rg_password:
                //密码登录
                //验证码登录
                tv_password.setText(getString(R.string.login_password));
                et_password.setHint(getString(R.string.input_password));
                btn_forget.setText(getString(R.string.forget_password));
                ck_remember.setVisibility(View.VISIBLE);//显示
                break;
            case R.id.rg_vertifycode:
                //验证码登录
                tv_password.setText(getString(R.string.verifycode));
                et_password.setHint(getString(R.string.input_verifycode));
                btn_forget.setText(getString(R.string.get_verifycode));
                ck_remember.setVisibility(View.GONE);//隐藏
                break;


        }
    }

    @Override
    public void onClick(View view) {
        String phone = et_phone.getText().toString();
        if (phone.length() < 11) {
            Toast.makeText(this, "手机号码不足11位", Toast.LENGTH_SHORT).show();
            return;
        }
        switch (view.getId()) {
            case R.id.btn_forget:
                //说明选择是密码登录
                // 此时按钮为忘记密码
                if (rg_password.isChecked()) {
                    //此时可将手机号传递给下一个忘记密码页面
                    Intent intent = new Intent(this, LoginForgetActivity.class);
                    intent.putExtra("phone", phone);
                    register.launch(intent);
                }else if(rg_vertifycode.isChecked()){
                    //生成6位随机验证码
                    verifyCode = String.format("%6d",new Random().nextInt(999999));
                    //弹出对话框 便于用户记住验证码
                    AlertDialog.Builder adb = new AlertDialog.Builder(this);
                    adb.setTitle("请记住验证码");
                    adb.setMessage("手机号"+phone+",验证码为"+verifyCode+",请输入验证码!");
                    adb.setPositiveButton("好的",null);
                    AlertDialog ad =adb.create();
                    ad.show();
                }
                break;
            case R.id.btn_login:
                //如果密码方式登录 判断密码是否正确
                if(rg_password.isChecked()){
                    if(!mPassword.equals(et_password.getText().toString())){
                        Toast.makeText(this,"请输入正确密码",Toast.LENGTH_SHORT).show();
                        return;
                    }
                    loginSuccess();
                }else if(rg_vertifycode.isChecked()){
                    if(!verifyCode.equals(et_password.getText().toString())){
                        Toast.makeText(this,"请输入正确验证码",Toast.LENGTH_SHORT).show();
                        return;
                    }
                    loginSuccess();
                }
                break;

        }
    }

    private void loginSuccess() {
        String desc=String.format("您的手机号码为%s,恭喜您登陆成功!",et_phone.getText().toString());
        AlertDialog.Builder adb = new AlertDialog.Builder(this);
        adb.setTitle("恭喜您登陆成功!");
        adb.setMessage("您的手机号为"+et_phone.getText().toString());
        adb.setNegativeButton("确定返回", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                //结束当前活动页面
                finish();
            }
        });
        adb.setPositiveButton("我再看看",null);
        AlertDialog ad = adb.create();
        ad.show();

    }

    //编辑框监听器,当输入文本长度达到最大长度,隐藏键盘。
    private class HideKeyboardWatch implements TextWatcher {
        private EditText mView;
        private int maxLen;

        public HideKeyboardWatch(EditText et, int len) {
            this.mView = et;
            this.maxLen = len;
        }

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

        }

        @Override
        public void afterTextChanged(Editable s) {
            if (s.toString().length() == maxLen) {
                //隐藏软键盘
                ViewUtil.hideKeyboard(LoginMainActivity.this, mView);
            }
        }
    }
}
login_forget_password.java
package com.example.learn;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import java.util.Random;

public class LoginForgetActivity extends AppCompatActivity implements View.OnClickListener {

    private String mPhone;
    private String verifyCode;
    private EditText et_password_first;
    private EditText et_password_second;
    private EditText et_verifycode;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login_forget);
        mPhone = getIntent().getStringExtra("phone");
        findViewById(R.id.btn_verificode).setOnClickListener(this);
        findViewById(R.id.btn_confirm).setOnClickListener(this); 
        et_password_first = findViewById(R.id.et_password_first);
        et_password_second = findViewById(R.id.et_password_second);
        et_verifycode = findViewById(R.id.et_verifycode);
    }


    @Override
    public void onClick(View view) {
        switch(view.getId()){
            case R.id.btn_verificode:
                //生成6位随机验证码
                verifyCode = String.format("%6d",new Random().nextInt(999999));
                //弹出对话框 便于用户记住验证码
                AlertDialog.Builder adb = new AlertDialog.Builder(this);
                adb.setTitle("请记住验证码");
                adb.setMessage("手机号"+mPhone+",验证码为"+verifyCode+",请输入验证码!");
                adb.setPositiveButton("好的",null);
                AlertDialog ad =adb.create();
                ad.show();
                break;
            case R.id.btn_confirm:
                String pf = et_password_first.getText().toString();
                String ps = et_password_second.getText().toString();
                if(pf.length()<6){
                    Toast.makeText(this,"请输入正确密码",Toast.LENGTH_SHORT).show();
                    return;
                }
                if(!pf.equals(ps)){
                    Toast.makeText(this,"两次密码不同",Toast.LENGTH_SHORT).show();
                    return;
                }
                if(!verifyCode.equals(et_verifycode.getText().toString())){
                    Toast.makeText(this,"验证码不正确",Toast.LENGTH_SHORT).show();
                    return;
                }
                Toast.makeText(this,"密码修改成功",Toast.LENGTH_SHORT).show();
                Intent intent = new Intent();
                intent.putExtra("new_password",pf);
                setResult(Activity.RESULT_OK,intent);
                finish();//结束当前页面


                break;
        }
    }
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/606257.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Agent AI:智能代理的未来

&#x1f388;写在前面 &#x1f64b;‍♂️大家好呀&#xff0c;我是超梦梦梦梦 &#x1f64b;‍♂️ 小伙伴们如果在学习过程中有不明白的地方&#xff0c;欢迎评论区留言提问&#xff0c;小梦定知无不言&#xff0c;言无不尽。 目录 一、Agent AI的起源与发展 二、Agent A…

js,JavaScript 对象(2024-05-02)

对象是 JavaScript 的数据类型之一。 对象用于存储键/值&#xff08;名称/值&#xff09;集合。 JavaScript 对象是命名值的集合。 下例创建具有四个键/值属性的 JavaScript 对象&#xff1a; const person {firstName: "Bill",lastName: "Gates",age:…

Linux中的简单操作 ls/tar/pwd/cd/mkdir/touch 等

目录 前言 安装和卸载软件包 ls 查看指定路径下的文件和文件夹 tar 解压缩/压缩命令 pwd 查看当前路径 cd 改变目录 mkdir 创建目录 递归创建 rm rmdir 删除文件或目录 touch 创建文件 ll、echo、重定向符&#xff08;>,>>&#xff09; ll echo 重定向符…

嵌入式C语言高级教程:实现基于STM32的无线远程监控系统

无线远程监控系统可以广泛应用于安防、环境监测等领域&#xff0c;提供实时数据传输和警报功能。本教程将指导您如何在STM32微控制器上实现一个基本的无线远程监控系统。 一、开发环境准备 硬件要求 微控制器&#xff1a;STM32L476RG&#xff0c;特别适合低功耗应用。开发板…

MySQL数据库实验三

本文承接前面的俩次实验基础上完成&#xff0c;不过实现的都是基础操作的练习 目录 目录 前言 实验目的 实验要求 实验内容及步骤 updata操作 delete操作 alter操作 添加列 删除列 修改列的数据类型 要求实现 实验结果 代码结果 注意事项 思考题 总结 前言 本文是MySQL数据库…

c++11 lambda 捕获,匿名,返回类型后置

lambda就是即写即用的匿名函数&#xff0c;可以用于解决匹配函数参数的问题 int main(int argc,char *argv[]) {vector<int> v{1,2,3,4,5,6,7,8};for_each(v.begin(),v.end(),[](int a){cout<<a;});return 0; } for_each是固定函数&#xff0c;我们需要他但是又没…

MySQL中JOIN连接的实现算法

目录 嵌套循环算法&#xff08;NLJ&#xff09; 简单嵌套循环&#xff08;SNLJ&#xff09; 索引嵌套循环&#xff08;INLJ&#xff09; 块嵌套循环&#xff08;BNLJ&#xff09; 三种算法比较 哈希连接算法&#xff08;Hash Join&#xff09; 注意事项&#xff1a; 工…

分享5个免费AI一键生成毕业论文的网站

一、引言 对于忙碌的学生来说&#xff0c;毕业论文通常是一项艰巨的任务。幸运的是&#xff0c;随着人工智能技术的发展&#xff0c;现在有一些工具可以帮助学生轻松完成论文。本文将介绍五个免费的AI工具&#xff0c;它们能够一键帮助你生成毕业论文&#xff0c;让你的学术生…

Linux流程控制

if语句 基本格式 if condition thencommand1 fi 写成一行 if [ $(ps -ef | grep -c "ssh") -gt 1 ]; then echo "true"; fi if-else语句 格式 if condition thencommand1 command2...commandN elsecommand fi if else- if else if condition1 th…

wordpress忘记后台密码,在数据库中修改回来,然后再修改回去。

源地址&#xff1a;https://www.ctvol.com/seoomethods/1421332.html 我们在做wordpess运维的时候&#xff0c;都会遇到很尴尬的时候&#xff0c;有时候在错误运维中&#xff0c;不知道删除了什么东西&#xff0c;造成wordpress后台不能登录&#xff0c;后台页面也直接失效&am…

Google Chrome浏览器便携增强版 v124.0.6367.61

01 软件介绍 Google Chrome v124.0.6367.61&#xff0c;这一版本经过精心设计&#xff0c;集成了一系列的功能增强和关键补丁&#xff0c;旨在提升用户体验。其中&#xff0c;Chrome引入了便携性数据保存选项&#xff0c;优化了标签页及标签栏的操作机制。此外&#xff0c;它还…

互联网黑话知所多少?

互联网黑话是互联网公司形成的一套带有浓厚互联网行业特色的“非正式语言”。这些黑话通常起源于社交媒体、网络论坛、技术博客以及职场交流中&#xff0c;它们可能是缩写词、行业术语、梗或者其它专业领域的词汇。来盘一盘你常听、常用的互联网黑话都有哪些吧&#xff01;

分布式与一致性协议之ZAB协议(七)

ZAB协议 ZAB协议:如何处理读写请求 你应该有这样的体会&#xff0c;如果你想了解一个网络服务&#xff0c;执行的第一个功能肯定是写操作&#xff0c;然后才会执行读操作。比如&#xff0c;你要了解ZooKeeper&#xff0c;那么肯定会在zkClient.sh命令行中执行写操作(比如crea…

SAP PP学习笔记09 - 作业区(工作中心Work Center)Customize2(管理码,班次顺序,计算式),标准Text,作业区阶层

上文讲了作业区&#xff08;工作中心&#xff09;的概念及其中重要字段&#xff0c;以及作业区的部分Customize。 SAP PP学习笔记08 - 作业区&#xff08;工作中心Work Center&#xff09;&#xff0c;作业区Customize-CSDN博客 本文继续讲 作业区的Customize。 Spro > 生…

杨氏矩阵查找算法

有一个数字矩阵&#xff0c;矩阵的每行从左到右是递增的&#xff0c;矩阵从上到下是递增的&#xff0c;请编写程序在这样的矩阵中查找某个数字是否存在。 要求&#xff1a;时间复杂度小于O(N); 1.首先更直观地了解一下杨氏矩阵&#xff1a; 123456789 这就是一个简单的杨氏矩…

【Java】初识网络编程

文章目录 前言✍一、互联网的发展1.独立模式2.网络的出现局域网LAN广域网WAN ✍二、网络编程概述✍三、网络编程中的术语介绍IP地址端口号协议OSI七层模型TCP\IP四层模型 ✍四、协议的层级之间是如何配合工作的 前言 在本文中&#xff0c;会对网络编程的一些术语进行解释&#…

MySQL变量的声明与使用

set userName 刘德华; SELECT userName : 刘青云; SELECT userName as 读取到的userName变量值; set x5,y7; SELECT x y as 57的结果; set dx0.55,dy2; SELECT dx dy; set result(select dx dy) SELECT result; set cityName1Kabul; SET cityName2Qandahar; SET cityName3…

【Qt 开发基础体系】字符串类应用和常用的数据类型

文章目录 1. Qt 字符串类应用1.1 操作字符串1.2 QString::append()函数1.3 QString::sprintf()函数1.4 QString::arg()函数 2. 查询字符串2.1 函数 QString::startsWith()2.2 函数 QString::contains()2.3 函数 QString::toInt()2.4 函数 QString::compare()2.5 将 QString 转换…

RS232引脚方向及意义与接线参考

RS232引脚方向及定义编号引脚意义方向作为IO使用说明1CD载波检测(Carrier Detect)计算机《调制解调器输入调制解调器通知计算机有载波被侦测到2RXD接收(Receive)计算机《调制解调器 接收数据3TXD发送(Transmit)计算机》调制解调器 发送数据4DTR数据终端设备(DTE)备好(Data Te…

揭秘豆瓣网站爬虫:利用lua-resty-request库获取图片链接

介绍 在网络数据采集领域&#xff0c;爬虫技术在图片获取方面具有广泛的应用。而豆瓣网站作为一个内容丰富的综合性平台&#xff0c;其图片资源也是广受关注的热点之一。本文将聚焦于如何利用Lua语言中的lua-resty-request库&#xff0c;高效地从豆瓣网站获取图片链接。我们将…