面试题:get和post的区别 and HTTP 与 HTTPS 区别

一、get和post的区别

1、url的可见性

    get把请求的数据放在url上,参数url可见

    post把数据放在http的包体内,参数url不可见

2、传输数据的大小

     get一般传输大小不超过2K~4K

     Post请求传输的大小根据php.ini配置文件设定,可以无限大

3、数据传输上

     get通过拼接url进行传递参数

     post通过body体传输参数

4、后退页面的反应

     Get请求页面后退时,不产生影响

     post请求页面后退时,会重新提交请求

5、缓存性

       get请求是可以缓存的

       post请求不可以缓存

6、post相比安全性高点,但是get效率高

 

二、HTTP 与 HTTPS 区别

1、HTTP 明文传输,数据都是未加密的,安全性较差,HTTPS(SSL+HTTP) 数据传输过程是加密的,安全性较好。

2、使用 HTTPS 协议需要到 CA(Certificate Authority,数字证书认证机构) 申请证书,一般免费证书较少,因而需要一定费用。证书颁发机构如:Symantec、Comodo、GoDaddy 和 GlobalSign 等。

3、HTTP 页面响应速度比 HTTPS 快,主要是因为 HTTP 使用 TCP 三次握手建立连接,客户端和服务器需要交换 3 个包,而 HTTPS除了 TCP 的三个包,还要加上 ssl 握手需要的 9 个包,所以一共是 12 个包。

4、http 和 https 使用的是完全不同的连接方式,用的端口也不一样,前者是 80,后者是 443。

5、HTTPS 其实就是建构在 SSL/TLS 之上的 HTTP 协议,所以,要比较 HTTPS 比 HTTP 要更耗费服务器资源。

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
题目描述: 给定一篇手写笔记的图片,要求用代码实现将其还原成文字。 示例: 输入: ![handwriting](https://cdn.luogu.com.cn/upload/image_hosting/jz2h2y1f.png) 输出: ``` Hello, world! This is a handwriting recognition problem. Can you solve it? Let's see. 1. First, let's import some libraries. - numpy: a popular library for numerical computing - PIL: Python Imaging Library, for image processing - tensorflow: a popular library for machine learning 2. Next, let's load the image and preprocess it. - Convert it to grayscale - Resize it to a fixed size - Invert the colors 3. Now we can use a pre-trained OCR model to recognize the text. - We'll use Tesseract, an open-source OCR engine. - It works best on clean, high-quality images, so we'll need to do some post-processing. 4. Finally, let's print the recognized text and see how well we did. - We should be able to get pretty good accuracy if the image is clear and the text is legible. ``` 解题思路: 1. 首先需要加载一些常用的 Python 库,如 numpy、PIL 和 tensorflow。 2. 接着需要读取手写笔记的图片,并对其进行预处理。具体来说,需要将其转换为灰度图像、调整大小并反转颜色。 3. 接下来,可以使用一个预训练的 OCR 模型来识别文本。这里使用的是 Tesseract,一个开源的 OCR 引擎。需要注意的是,Tesseract 在处理高质量、清晰的图像时表现最佳,因此在处理后需要进行一些后处理。 4. 最后,将识别出的文本打印出来,以便进行检查。 代码实现: ```python import numpy as np from PIL import Image import pytesseract # Step 1: Load the image and preprocess it img = Image.open('handwriting.png').convert('L') img = img.resize((int(img.size[0] * 2), int(img.size[1] * 2))) img = ImageOps.invert(img) # Step 2: Use Tesseract to recognize the text text = pytesseract.image_to_string(img) # Step 3: Post-process the recognized text text = text.replace('\n\n', '\n') text = text.strip() # Step 4: Print the recognized text print(text) ``` 其中,`pytesseract` 库需要提前安装。在 Ubuntu 系统下,可以使用以下命令进行安装: ``` sudo apt install tesseract-ocr sudo apt install libtesseract-dev pip install pytesseract ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值