Library Search
结果页HTTP 服务器入门 — Hello World + 文件读写
在 知识库 中找到 8 个匹配结果。
知识库
知识库
8 个 01-hello-world-http-server # Node.js Hello World — HTTP 服务器
## 目标
用 Node.js 内置 `http` 模块创建一个最简单的 Web 服务器,监听 3000 端口,返回 JSON 格式的 "Hello World"。
## 完整代码
```javascript
// server.js
const http = require('http');
const hostname… 3% Hello World `bash
php -S localhost:8000
```
浏览器访问 `http://localhost:8000/hello.php`,页面显示:
```
Hello, World!
今天的日期是:2026-01-15
```
## 方式三:嵌入 HTML
创建 `index.php`:
```php
<!DOCTYPE html>
<html>
<head><title>PHP… 3% Hello World - 控制器与路由 stractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;
class HelloController extends AbstractController
{
#[Route('/api/hello', name:… 3% 01-hello-world-spring-boot # Java Hello World — Spring Boot REST API
## 目标
用 Spring Boot 3 创建一个 RESTful Web 服务,返回 JSON 格式的 "Hello World"。
## 完整代码
```java
// HelloWorldApplication.java
package com.example.demo;
import org.sp… 3% Requests 从入门到精通 # Requests 从入门到精通
## 背景
HTTP 是互联网应用层最核心的协议。Requests 将这个协议中每次都需要处理的 headers、cookies、认证、超时等细节封装得极其优雅,让开发者专注于业务逻辑。
---
## 第 1 章:HTTP 方法速览
```python
import requests
# GET — 获取资源
r = requests.get("ht… 3% Hello World 与 LINQ 入门 # C# Hello World 与 LINQ 入门
## 目标
展示 .NET 8 控制台应用的 Hello World,以及 LINQ 查询、async/await 的基本用法。
## 完整代码
```csharp
// Program.cs - .NET 8 顶级语句
using System;
using System.Collections.Generic;
using Syste… 3% Hello World — GET 请求与 JSON 解析 目标
发送一个 GET 请求到公开 API,解析 JSON 响应,并处理常见 HTTP 状态码。
## 完整代码
```python
import requests
# 1. 基础 GET 请求
url = "https://api.github.com/repos/psf/requests"
response = requests.get(url)
# 2. 检查状态码
print(f… 3% HTTP 服务器入门 — Hello World + 文件读写 # Node.js HTTP 服务器入门
## 目标
使用 Node.js 内置 `http` 模块和 `fs` 模块,创建最简单的 Web 服务器,并实现文件读写演示。
## 完整代码
```javascript
// server.js
const http = require('http');
const fs = require('fs');
const path = require… 3%