微服务——RestClient查询文档

news2024/11/28 4:35:40

快速入门

返回结果直接把json风格的结果封装为SearchReponse对象返回

public class HotelSearchTest {
    private RestHighLevelClient client;

    @Test
    void testMatchAll() throws IOException {
        //1.准备request
        SearchRequest request = new SearchRequest("hotel");
        //2.准备DSl
        request.source().query(QueryBuilders.matchAllQuery());
        //3.发送请求
        SearchResponse response = client.search(request, RequestOptions.DEFAULT);

        System.out.println(response);
    }
    

    //执行前初始化
    @BeforeEach
    void setUp(){
        this.client=new RestHighLevelClient(RestClient.builder(
                HttpHost.create("http://xxx.xxx.xxx.xxx:9200")
              //HttpHost.create("http://xxx.xxx.xxx.xxx:9200") 集群时添加更多的地址
        ));
    }

    //销毁
    @AfterEach
    void tearDown() throws IOException {
        this.client.close();
    }
}

 

 响应结果解析 

    @Test
    void testMatchAll() throws IOException {
        //1.准备request
        SearchRequest request = new SearchRequest("hotel");
        //2.准备DSl
        request.source().query(QueryBuilders.matchAllQuery());
        //3.发送请求
        SearchResponse response = client.search(request, RequestOptions.DEFAULT);

        //4.解析响应
        SearchHits searchHits = response.getHits();
        //4.1获取总条数
        long total = searchHits.getTotalHits().value;
        System.out.println("共搜索到"+total+"条数据");
        //4.2文档数组
        SearchHit[] hits = searchHits.getHits();
        //4.3遍历
        for (SearchHit hit : hits) {
            //获取文档source
            String json = hit.getSourceAsString();
            //反序列化
            HotelDoc hotelDoc = JSON.parseObject(json, HotelDoc.class);
            System.out.println("hotelDoc="+hotelDoc);
        }
    }

 默认只返回前10条数据 

 

 

 在.source()中query,排序,分页,高亮等功能

QueryBuildes中准备了所有查询,match,match_all,boolean等

match、term、range、bool查询

全文检索查询

 

    @Test
    void testMatch() throws IOException {
        //1.准备request
        SearchRequest request = new SearchRequest("hotel");
        //2.准备DSl
        request.source().query(QueryBuilders.matchQuery("all","如家"));
        //3.发送请求
        SearchResponse response = client.search(request, RequestOptions.DEFAULT);

        //4.解析响应
        SearchHits searchHits = response.getHits();
        //4.1获取总条数
        long total = searchHits.getTotalHits().value;
        System.out.println("共搜索到"+total+"条数据");
        //4.2文档数组
        SearchHit[] hits = searchHits.getHits();
        //4.3遍历
        for (SearchHit hit : hits) {
            //获取文档source
            String json = hit.getSourceAsString();
            //反序列化
            HotelDoc hotelDoc = JSON.parseObject(json, HotelDoc.class);
            System.out.println("hotelDoc="+hotelDoc);
        }
    }

对比match和match_all,不同的地方只有一点点,这里直接抽取4往后的公共部分,使用ctrl+alt+m抽取

 

public class HotelSearchTest {
    private RestHighLevelClient client;

    @Test
    void testMatchAll() throws IOException {
        //1.准备request
        SearchRequest request = new SearchRequest("hotel");
        //2.准备DSl
        request.source().query(QueryBuilders.matchAllQuery());
        //3.发送请求
        SearchResponse response = client.search(request, RequestOptions.DEFAULT);

        handleResponse(response);
    }

    @Test
    void testMatch() throws IOException {
        //1.准备request
        SearchRequest request = new SearchRequest("hotel");
        //2.准备DSl
        request.source().query(QueryBuilders.matchQuery("all","如家"));
        //3.发送请求
        SearchResponse response = client.search(request, RequestOptions.DEFAULT);

        handleResponse(response);
    }

    private static void handleResponse(SearchResponse response) {
        //4.解析响应
        SearchHits searchHits = response.getHits();
        //4.1获取总条数
        long total = searchHits.getTotalHits().value;
        System.out.println("共搜索到"+total+"条数据");
        //4.2文档数组
        SearchHit[] hits = searchHits.getHits();
        //4.3遍历
        for (SearchHit hit : hits) {
            //获取文档source
            String json = hit.getSourceAsString();
            //反序列化
            HotelDoc hotelDoc = JSON.parseObject(json, HotelDoc.class);
            System.out.println("hotelDoc="+hotelDoc);
        }
    }


    //执行前初始化
    @BeforeEach
    void setUp(){
        this.client=new RestHighLevelClient(RestClient.builder(
                HttpHost.create("http://xxx.xxx.xxx.xxx:9200")
              //HttpHost.create("http://xxx.xxx.xxx.xxx:9200") 集群时添加更多的地址
        ));
    }

    //销毁
    @AfterEach
    void tearDown() throws IOException {
        this.client.close();
    }
}

 精确查询

 

一个boolean查询里面包含了term查询和 range查询

@Test
    void testBool() throws IOException {
        //1.准备request
        SearchRequest request = new SearchRequest("hotel");
        //2.准备DSl
        //2.1准备BooleanQuery
        BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
        //2.2添加term
        boolQuery.must(QueryBuilders.termQuery("city","上海"));
        //2.3添加range
        boolQuery.filter(QueryBuilders.rangeQuery("price").lte(250));

        request.source().query(boolQuery);
        //3.发送请求
        SearchResponse response = client.search(request, RequestOptions.DEFAULT);

        handleResponse(response);
    }

 

 排序和分页

    @Test
    void testPageAndSort() throws IOException {
        //前端传来页码,每页大小
        int page=1,size=5;
        //1.准备request
        SearchRequest request = new SearchRequest("hotel");
        //2.准备DSl
        //2.1准备query
        request.source().query(QueryBuilders.matchAllQuery());
        //2.2排序 sort
        request.source().sort("price", SortOrder.ASC);
        //2.3分页 from,size
        request.source().from((page-1)*size).size(5);
        //3.发送请求
        SearchResponse response = client.search(request, RequestOptions.DEFAULT);

        handleResponse(response);
    }

 

高亮

构建

    @Test
    void testHighlight() throws IOException {
        //1.准备request
        SearchRequest request = new SearchRequest("hotel");
        //2.准备DSl
        //2.1准备query
        request.source().query(QueryBuilders.matchQuery("all","如家"));
        //2.2高亮
        request.source().highlighter(new HighlightBuilder().field("name").requireFieldMatch(false));
        //3.发送请求
        SearchResponse response = client.search(request, RequestOptions.DEFAULT);
        //4.解析响应
        handleResponse(response);
    }

 

 

 解析

 逐层解析json结果

    @Test
    void testHighlight() throws IOException {
        //1.准备request
        SearchRequest request = new SearchRequest("hotel");
        //2.准备DSl
        //2.1准备query
        request.source().query(QueryBuilders.matchQuery("all","如家"));
        //2.2高亮
        request.source().highlighter(new HighlightBuilder().field("name").requireFieldMatch(false));
        //3.发送请求
        SearchResponse response = client.search(request, RequestOptions.DEFAULT);
        //4.解析响应
        handleResponse(response);
    }

    private static void handleResponse(SearchResponse response) {
        //4.解析响应
        SearchHits searchHits = response.getHits();
        //4.1获取总条数
        long total = searchHits.getTotalHits().value;
        System.out.println("共搜索到"+total+"条数据");
        //4.2文档数组
        SearchHit[] hits = searchHits.getHits();
        //4.3遍历
        for (SearchHit hit : hits) {
            //获取文档source
            String json = hit.getSourceAsString();
            //反序列化
            HotelDoc hotelDoc = JSON.parseObject(json, HotelDoc.class);

            //获取高亮结果
            Map<String, HighlightField> highlightFields = hit.getHighlightFields();
            if(!CollectionUtils.isEmpty(highlightFields)) //判断map是否为空的工具类
            {
                //根据名字获取高亮结果
                HighlightField highlightField = highlightFields.get("name");
                if(highlightField!=null){
                    //获取高亮值
                    String name = highlightField.getFragments()[0].string();
                    //覆盖非高亮结果
                    hotelDoc.setName(name);
                }
            }
            System.out.println("hotelDoc="+hotelDoc);
        }
    }

 

 黑马旅游案例——酒店搜索和分页

 定义实体类

用于接收前端传来的参数

@Data
public class RequestParams {
    private String key;
    private Integer page;
    private Integer size;
    private String sortBy;
}

Controller层中

 返回值定义

@Data
public class PageResult {
    private Long total;
    private List<HotelDoc> hotels;

    public PageResult() {
    }

    public PageResult(Long total, List<HotelDoc> hotels) {
        this.total = total;
        this.hotels = hotels;
    }
}

在启动类中定义一个Bean

@MapperScan("cn.itcast.hotel.mapper")
@SpringBootApplication
public class HotelDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(HotelDemoApplication.class, args);
    }
    @Bean
    public RestHighLevelClient client(){
        return new RestHighLevelClient(RestClient.builder(
                HttpHost.create("http://xxx.xxx.xxx.xxx:9200")
                //HttpHost.create("http://xxx.xxx.xxx.xxx:9200") 集群时添加更多的地址
        ));
    }
}
@RestController
@RequestMapping("hotel")
public class HotelController {

    @Autowired
    private IHotelService hotelService;

    /**
     * 搜索和分页
     * @param requestParams
     * @return
     */
    @PostMapping("/list")
    public PageResult search(@RequestBody RequestParams requestParams){
        return hotelService.search(requestParams);
    }
}

 

Service层中

public interface IHotelService extends IService<Hotel> {
    PageResult search(RequestParams requestParams);
}
@Service
public class HotelService extends ServiceImpl<HotelMapper, Hotel> implements IHotelService {
    @Autowired
    private RestHighLevelClient client;
    @Override
    public PageResult search(RequestParams requestParams) {

        try {
        //1.准备request
        SearchRequest request = new SearchRequest("hotel");
        //2.准备DSl
        //2.1query
        String key= requestParams.getKey();
        if(key==null||"".equals(key)){  //没有查询内容时直接查询全部
            request.source().query(QueryBuilders.matchAllQuery());
        }else {
            request.source().query(QueryBuilders.matchQuery("all", key));
        }
        //2.2分页
        int page=requestParams.getPage();
        int size=requestParams.getSize();
        request.source().from((page-1)*size).size(size);
        //3.发送请求
        SearchResponse response= client.search(request, RequestOptions.DEFAULT);
            //4.解析响应
            handleResponse(response);
            return null;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    private PageResult handleResponse(SearchResponse response) {
        //4.解析响应
        SearchHits searchHits = response.getHits();
        //4.1获取总条数
        long total = searchHits.getTotalHits().value;
        System.out.println("共搜索到"+total+"条数据");
        //4.2文档数组
        SearchHit[] hits = searchHits.getHits();
        //4.3遍历
        List<HotelDoc> hotels=new ArrayList<>();
        for (SearchHit hit : hits) {
            //获取文档source
            String json = hit.getSourceAsString();
            //反序列化
            HotelDoc hotelDoc = JSON.parseObject(json, HotelDoc.class);
            hotels.add(hotelDoc);
        }

        return new PageResult(total,hotels);
    }
}

 

成功搜索

 

 黑马旅游案例——条件过滤

修改DTO

@Data
public class RequestParams {
    private String key;
    private Integer page;
    private Integer size;
    private String sortBy;
    private String brand;
    private String starName;
    private String city;
    private Integer minPrice;
    private Integer maxPrice;
}

 

Service层中

修改如下,加了多条件过滤,并抽取出去

    @Override
    public PageResult search(RequestParams requestParams) {
        try {
             //1.准备request
             SearchRequest request = new SearchRequest("hotel");
             //2.准备DSl
            //2.1query
            buildBasicQuery(requestParams, request);

            //2.2分页
             int page=requestParams.getPage();
             int size=requestParams.getSize();
             request.source().from((page-1)*size).size(size);
             //3.发送请求
             SearchResponse response= client.search(request, RequestOptions.DEFAULT);
                 //4.解析响应
                return handleResponse(response);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    private static void buildBasicQuery(RequestParams requestParams, SearchRequest request) {
        //构建BooleanQuery
        BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
        //关键字搜索
        String key= requestParams.getKey();
        if(key==null||"".equals(key)){  //没有查询内容时直接查询全部
            boolQuery.must(QueryBuilders.matchAllQuery());
        }else {
            boolQuery.must(QueryBuilders.matchQuery("all", key));
        }
        //城市条件
        if(requestParams.getCity()!=null&&!requestParams.getCity().equals("")){
            boolQuery.filter(QueryBuilders.termQuery("city", requestParams.getCity()));
        }
        //品牌条件
        if(requestParams.getBrand()!=null&&!requestParams.getBrand().equals("")){
            boolQuery.filter(QueryBuilders.termQuery("brand", requestParams.getBrand()));
        }
        //星级条件
        if(requestParams.getStarName()!=null&&!requestParams.getStarName().equals("")){
            boolQuery.filter(QueryBuilders.termQuery("starName", requestParams.getStarName()));
        }
        //价格条件
        if(requestParams.getMinPrice()!=null&& requestParams.getMaxPrice()!=null){
            boolQuery.filter(QueryBuilders.rangeQuery("price")
                    .gte(requestParams.getMinPrice())
                    .lte(requestParams.getMaxPrice()));
        }
        request.source().query(boolQuery);
    }

 

 黑马旅游案例——我附近的酒店

距离排序 

DTO修改

@Data
public class RequestParams {
    private String key;
    private Integer page;
    private Integer size;
    private String sortBy;
    private String brand;
    private String starName;
    private String city;
    private Integer minPrice;
    private Integer maxPrice;
    private String location;
}

Service中 

 修改如下

新增2.3部分

    @Override
    public PageResult search(RequestParams requestParams) {
        try {
             //1.准备request
             SearchRequest request = new SearchRequest("hotel");
             //2.准备DSl
            //2.1query
            buildBasicQuery(requestParams, request);

            //2.2分页
             int page=requestParams.getPage();
             int size=requestParams.getSize();
             request.source().from((page-1)*size).size(size);

             //2.3排序
            String location = requestParams.getLocation();
            if(location!=null&&!location.equals("")){
                request.source().sort(SortBuilders
                        .geoDistanceSort("location",new GeoPoint(location))
                        .order(SortOrder.ASC)
                        .unit(DistanceUnit.KILOMETERS)
                );
            }
            //3.发送请求
             SearchResponse response= client.search(request, RequestOptions.DEFAULT);
                 //4.解析响应
                return handleResponse(response);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

DTO修改

@Data
@NoArgsConstructor
public class HotelDoc {
    private Long id;
    private String name;
    private String address;
    private Integer price;
    private Integer score;
    private String brand;
    private String city;
    private String starName;
    private String business;
    private String location;
    private String pic;
    private Object distance;

    public HotelDoc(Hotel hotel) {
        this.id = hotel.getId();
        this.name = hotel.getName();
        this.address = hotel.getAddress();
        this.price = hotel.getPrice();
        this.score = hotel.getScore();
        this.brand = hotel.getBrand();
        this.city = hotel.getCity();
        this.starName = hotel.getStarName();
        this.business = hotel.getBusiness();
        this.location = hotel.getLatitude() + ", " + hotel.getLongitude();
        this.pic = hotel.getPic();
    }
}

 Service修改

    private PageResult handleResponse(SearchResponse response) {
        //4.解析响应
        SearchHits searchHits = response.getHits();
        //4.1获取总条数
        long total = searchHits.getTotalHits().value;
        System.out.println("共搜索到"+total+"条数据");
        //4.2文档数组
        SearchHit[] hits = searchHits.getHits();
        //4.3遍历
        List<HotelDoc> hotels=new ArrayList<>();
        for (SearchHit hit : hits) {
            //获取文档source
            String json = hit.getSourceAsString();
            //反序列化
            HotelDoc hotelDoc = JSON.parseObject(json, HotelDoc.class);
            //获取排序值
            Object[] sortValues = hit.getSortValues();
            if(sortValues.length>0){
                Object sortValue = sortValues[0];
                hotelDoc.setDistance(sortValue);
            }
            hotels.add(hotelDoc);
        }
        return new PageResult(total,hotels);
    }

这里应该成功显示距离附近酒店以及距离了,但是我的电脑获取不到位置。 

  黑马旅游案例——广告置顶

 DTO修改

在HotelDoc中添加一个新字段

private Boolean isAD;

ES数据修改

 Service层修改

 

    private static void buildBasicQuery(RequestParams requestParams, SearchRequest request) {
        //1.构建BooleanQuery
        BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
        //关键字搜索
        String key= requestParams.getKey();
        if(key==null||"".equals(key)){  //没有查询内容时直接查询全部
            boolQuery.must(QueryBuilders.matchAllQuery());
        }else {
            boolQuery.must(QueryBuilders.matchQuery("all", key));
        }
        //城市条件
        if(requestParams.getCity()!=null&&!requestParams.getCity().equals("")){
            boolQuery.filter(QueryBuilders.termQuery("city", requestParams.getCity()));
        }
        //品牌条件
        if(requestParams.getBrand()!=null&&!requestParams.getBrand().equals("")){
            boolQuery.filter(QueryBuilders.termQuery("brand", requestParams.getBrand()));
        }
        //星级条件
        if(requestParams.getStarName()!=null&&!requestParams.getStarName().equals("")){
            boolQuery.filter(QueryBuilders.termQuery("starName", requestParams.getStarName()));
        }
        //价格条件
        if(requestParams.getMinPrice()!=null&& requestParams.getMaxPrice()!=null){
            boolQuery.filter(QueryBuilders.rangeQuery("price")
                    .gte(requestParams.getMinPrice())
                    .lte(requestParams.getMaxPrice()));
        }

        //2.算分控制
        FunctionScoreQueryBuilder functionScoreQueryBuilder =
                QueryBuilders.functionScoreQuery(
                        //原始查询,相关性算分的查询
                        boolQuery,
                        //function score的数组
                        new FunctionScoreQueryBuilder.FilterFunctionBuilder[]{
                                //其中的一个function score 元素
                                new FunctionScoreQueryBuilder.FilterFunctionBuilder(
                                        //过滤条件
                                        QueryBuilders.termQuery("isAD",true),
                                        //算分函数
                                        ScoreFunctionBuilders.weightFactorFunction(10)
                                )
                        });
        request.source().query(functionScoreQueryBuilder);
    }

最终查询时就可以看见置顶的广告了

 

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

嵌入式基础知识-存储管理

上篇介绍了存储器的相关知识&#xff0c;偏重的是硬件结构&#xff0c;本篇介绍存储管理的相关知识&#xff0c;偏重的是软件管理。 1 存储管理概念 操作系统&#xff0c;包括嵌入式系统&#xff0c;通常利用存储管理单元MMU&#xff08;Memory Management Unit&#xff09;来…

OB数据库基础知识(学习记录)

目录 OB业务场景 公司使用理由&#xff1a; 常见 bootstrap 失败原因 常见OBD 部署 失败原因 Grafana 查看集群资源由各个节点的聚合情况 OB创建租户 表分组的场景 mysqldump到处数据库schema&#xff0c;数据库数据&#xff0c;表数据 数据同步框架 DATAX obdumper…

支付总架构解析

一、支付全局分层 一笔支付以用户为起点&#xff0c;经过众多支付参与者之后&#xff0c;到达央行的清算账户&#xff0c;完成最终的资金清算。那么我们研究支付宏观&#xff0c;可以站在央行清算账户位置&#xff0c;俯视整个支付金字塔&#xff0c;如图1所示&#xff1a; 图…

Java课题笔记~6个重要注解参数含义

1、[掌握]Before 前置通知-方法有 JoinPoint 参数 在目标方法执行之前执行。被注解为前置通知的方法&#xff0c;可以包含一个 JoinPoint 类型参数。 该类型的对象本身就是切入点表达式。通过该参数&#xff0c;可获取切入点表达式、方法签名、目标对象等。 不光前置通知的方…

乍得ECTN(BESC)申请流程

根据TCHAD/CHAD乍得法令&#xff0c;自2013年4月1日起&#xff0c;所有运至乍得的货物都必须申请ECTN(BESC)电子货物跟踪单。如果没有申请&#xff0c;将被视为触犯乍得的条例&#xff0c;并在目的地受到严厉惩罚。ECTN是英语ELECTRONIC CARGO TRACKING NOTE的简称&#xff1b;…

EFLFK——ELK日志分析系统+kafka+filebeat架构

环境准备 node1节点192.168.40.16elasticsearch2c/4Gnode2节点192.168.40.17elasticsearch2c/4GApache节点192.168.40.170logstash/Apache/kibana2c/4Gfilebeat节点192.168.40.20filebeat2c/4G https://blog.csdn.net/m0_57554344/article/details/132059066?spm1001.2014.30…

oracle的管道函数

Oracle管道函数(Pipelined Table Function)oracle管道函数 1、管道函数即是可以返回行集合&#xff08;可以使嵌套表nested table 或数组 varray&#xff09;的函数&#xff0c;我们可以像查询物理表一样查询它或者将其赋值给集合变量。 2、管道函数为并行执行&#xff0c;在…

【数据结构与算法】十大经典排序算法-冒泡排序

&#x1f31f;个人博客&#xff1a;www.hellocode.top &#x1f3f0;Java知识导航&#xff1a;Java-Navigate &#x1f525;CSDN&#xff1a;HelloCode. &#x1f334;掘金&#xff1a;HelloCode &#x1f31e;知乎&#xff1a;HelloCode ⚡如有问题&#xff0c;欢迎指正&#…

VSCode中如何修改代码字体

通过「File」→「Preferences」→「Settings」→「Text Editor」→「Font」→「Font Family」中&#xff0c;修改对应的字体即可。因为比较喜欢 JetBrains Mono&#xff0c;所以设置的字体是这个。 其中Jetbrains Mono字体需要自己在Jetbrains官网下载&#xff0c;然后中文字体…

09. Docker Compose

目录 1、前言 2、安装Docker Compose 2.1、Docker Compose版本 2.2、下载安装 3、初试Docker Compose 3.1、传统方案部署应用 3.2、使用编排部署应用 3.3、其他命令 3.3.1、ps 3.3.2、images 3.3.3、depends_on 3.3.4、scale 4、小结 1、前言 随着应用架构的不段…

Scala按天写入日志文件

如果希望把每天出错的信息写入日志文件&#xff0c;每天新建一个文件。 package test.scala import java.io.{File, FileWriter} import java.text.SimpleDateFormat import java.util.{Calendar, Date} import scala.concurrent.ExecutionContext.Implicits.global import sc…

Linux(CentOS7)系统磁盘分区及挂载

新购买的阿里云服务器&#xff0c;默认硬盘容量肯定不够用&#xff0c;需要额外购买硬盘&#xff0c;购买后需要对硬盘进行分区及挂载操作&#xff0c;下面是硬盘分区及挂载操作步骤&#xff1a; 1、查看未挂载的硬盘&#xff08;名称为/dev/vdb&#xff09;, 执行命令 fdisk …

SpringBoot运行流程源码分析------阶段二(run方法核心流程)

run方法核心流程 在分析和学习整个run方法之前&#xff0c;我们可以通过以下流程图来看下SpringApplication调用的run方法处理的核心操作包含哪些。 从上面的流程图中可以看出&#xff0c;SpringApplication在run方法中重点做了以下几步操作 获取监听器和参数配置打印banner…

懒人的百宝箱,效率回归,工具库之美「GitHub 热点速览」

懒人的百宝箱&#xff0c;效率回归&#xff0c;工具库之美「GitHub 热点速览」。 刚开源就变成新星的 igl&#xff0c;不仅获得了 2k star&#xff0c;也能提高你开发游戏的效率&#xff0c;摆平一切和图形有关的问题。如果这个没有那么惊艳的话&#xff0c;还有 The-Art-of-L…

CTFshow web93-104关

这周要学习的是php代码审计 根据师兄的作业 来做web入门的93-104关 93关 看代码 进行分析 他的主函数 include("flag.php"); highlight_file(__FILE__); if(isset($_GET[num])){ $num $_GET[num]; if($num4476){ die("no no no!"); …

nuxt脚手架创建项目

在初始化时遇到一个依赖找不到的问题&#xff0c;记录一下&#xff0c;如有遇到同样问题的小伙伴&#xff0c;希望能给你们一点指引。 从安装脚手架开始&#xff0c;首先 一&#xff1a;安装nuxt脚手架 1. C盘全局安装&#xff1a; npm i -g create-nuxt-app 安装后可creat…

云迁移解决方案

云迁移是指将应用程序和数据从一个位置&#xff08;通常是公司自有的现场&#xff08;“本地”服务器&#xff09;迁移到公有云提供商的服务器的过程&#xff0c;但也指在不同的云之间进行迁移的过程。云迁移的主要优势包括降低 IT 成本和提高性能&#xff0c;但也存在安全性、…

EVE-NG MPLS L2VPN LDP lsp

目录 1 拓扑 2 配置步骤 2.1 配置接口IP 和路由协议 2.2 配置MPLS LDP 2.3 配置L2VPN PW(LDP) 2.4 验证L2VPN 1 拓扑 2 配置步骤 2.1 配置接口IP 和路由协议 PE1 interface LoopBack 0ip address 1.1.1.9 32 quitinterface GigabitEthernet1/0ip address 10.1.1.1 25…

Docker-compose应用

Docker-compose Docker-compose 是Dcoker官方推出的Docker容器的一键编排工具&#xff0c;使用Docker-compose可以批量启动容器、停止容器等等。 安装 github地址 https://github.com/docker/compose/tree/v2.20.1 下载地址 https://github.com/docker/compose/releases …

pinctrl_desc函数操作集实现

pinctrl_desc函数操作集实现 文章目录 pinctrl_desc函数操作集实现groups和functionimx_pctrl_opsimx_get_groups_countimx_get_group_nameimx_get_group_pinsimx_pin_dbg_showimx_dt_free_map imx_pmx_opsimx_pmx_setimx_pmx_get_funcs_countimx_pmx_get_func_nameimx_pmx_get…