Flask 博客系統(Flask Blog System)

目標:零基礎也能從頭搭建一個支持文章管理、評論、分類標簽、搜索、用戶登錄的博客系統
技術棧:Flask + SQLite + SQLAlchemy + Jinja2 + HTML/CSS + Flask-Login
開發工具:VSCode
學習重點:MVC 模式、數據庫操作、會話管理、表單處理

一、項目概述

本項目是一個基于 Python Web 框架 Flask 構建的輕量級個人博客系統,旨在為開發者提供一個功能完整、結構清晰、易于學習和擴展的 Web 應用范例。系統采用 MVC 設計模式 組織代碼結構,使用 SQLite 作為數據庫,結合 HTML/CSS 前端模板 實現用戶友好的交互界面,完整實現了博客核心功能模塊。

該系統不僅具備實用價值,更注重教學意義,特別適合 Python Web 開發初學者理解 Web 請求響應機制、數據庫操作、用戶會話管理與前后端交互流程。

二、技術棧

類別技術
后端框架Flask (輕量級 Python Web 框架)
數據庫SQLite(嵌入式數據庫,無需額外服務)
ORMFlask-SQLAlchemy(對象關系映射,簡化數據庫操作)
用戶認證Flask-Login(管理用戶登錄狀態與會話)
前端技術HTML5 + CSS3 + Jinja2 模板引擎
安全機制密碼哈希(Werkzeug.security)、CSRF 防護(基礎)
開發工具VSCode、Python 虛擬環境

三、核心功能

  1. 文章管理

    • 支持文章的創建、編輯、刪除與查看詳情
    • 文章包含標題、內容、發布時間、作者信息
  2. 分類與標簽系統

    • 每篇文章可歸屬一個分類(如“技術”、“生活”)
    • 支持多標簽管理(如“Python”、“Flask”),便于內容組織與檢索
  3. 用戶評論功能

    • 登錄用戶可在文章頁發表評論
    • 評論按時間排序展示,增強互動性
  4. 全文搜索

    • 支持通過關鍵詞在文章標題和內容中進行模糊搜索
    • 搜索結果實時展示,提升用戶體驗
  5. 用戶系統與會話管理

    • 用戶注冊與登錄功能
    • 基于 Flask-Login 的會話管理,確保安全訪問控制
    • 權限控制:僅文章作者可編輯或刪除自己的文章
  6. 響應式前端界面

    • 使用原生 HTML/CSS 構建簡潔美觀的頁面布局
    • 支持導航菜單、消息提示、表單驗證等基礎交互

四、架構設計(MVC 模式)

系統嚴格遵循 MVC(Model-View-Controller)設計模式,實現關注點分離:

  • Model(模型層):由 models.py 定義數據模型(User、Post、Comment、Category、Tag),通過 SQLAlchemy 映射到 SQLite 數據庫。
  • View(視圖層):使用 Jinja2 模板引擎在 templates/ 目錄下渲染 HTML 頁面,實現動態內容展示。
  • Controller(控制器層)routes.py 中的路由函數處理 HTTP 請求,調用模型進行數據操作,并返回對應視圖。

五、項目特點

  • ? 零依賴外部服務:使用 SQLite,無需安裝數據庫服務器
  • ? 開箱即用:提供完整代碼與依賴文件,一鍵運行
  • ? 學習友好:代碼結構清晰,注釋詳盡,適合初學者理解 Web 開發全流程
  • ? 可擴展性強:模塊化設計,便于后續集成 Markdown 編輯器、分頁、REST API 等功能
  • ? 安全基礎:用戶密碼加密存儲,防止明文泄露

📁 項目目錄結構

/blog├── app.py                 # 主程序入口├── models.py              # 數據模型定義├── routes.py              # 路由與控制器邏輯├── config.py              # 配置文件├── requirements.txt       # 依賴包列表├── instance/│   └── blog.db            # 自動生成的 SQLite 數據庫├── templates/             # HTML 模板│   ├── base.html          # 布局模板│   ├── index.html         # 首頁│   ├── login.html         # 登錄頁│   ├── create_post.html   # 發布文章│   ├── post.html          # 文章詳情│   └── register.html      # 注冊頁(可選)└── static/└── style.css          # 樣式文件

? 第一步:環境準備

1. 創建項目文件夾

mkdir blog && cd blog

2. 創建虛擬環境

python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate

3. 安裝依賴

創建 requirements.txt 文件:

Flask==3.0.3
Flask-SQLAlchemy==3.1.1
Flask-Login==0.6.3
Werkzeug==3.0.3

安裝:

pip install -r requirements.txt

? 第二步:配置文件 config.py

# config.py
import osclass Config:SECRET_KEY = 'your-secret-key-here-change-it'  # 用于 session 加密SQLALCHEMY_DATABASE_URI = 'sqlite:///blog.db'SQLALCHEMY_TRACK_MODIFICATIONS = FalseDATABASE_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'instance', 'blog.db')

? 第三步:數據庫模型 models.py

# models.py
from flask_sqlalchemy import SQLAlchemy
from flask_login import UserMixin
from datetime import datetimedb = SQLAlchemy()# 關聯表:文章-標簽(多對多)
post_tags = db.Table('post_tags',db.Column('post_id', db.Integer, db.ForeignKey('post.id')),db.Column('tag_id', db.Integer, db.ForeignKey('tag.id'))
)class User(UserMixin, db.Model):id = db.Column(db.Integer, primary_key=True)username = db.Column(db.String(80), unique=True, nullable=False)password = db.Column(db.String(120), nullable=False)posts = db.relationship('Post', backref='author', lazy=True)comments = db.relationship('Comment', backref='author', lazy=True)class Category(db.Model):id = db.Column(db.Integer, primary_key=True)name = db.Column(db.String(50), unique=True, nullable=False)posts = db.relationship('Post', backref='category', lazy=True)class Tag(db.Model):id = db.Column(db.Integer, primary_key=True)name = db.Column(db.String(50), unique=True, nullable=False)class Post(db.Model):id = db.Column(db.Integer, primary_key=True)title = db.Column(db.String(120), nullable=False)content = db.Column(db.Text, nullable=False)created_at = db.Column(db.DateTime, default=datetime.utcnow)updated_at = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)category_id = db.Column(db.Integer, db.ForeignKey('category.id'))tags = db.relationship('Tag', secondary=post_tags, backref='posts')comments = db.relationship('Comment', backref='post', lazy=True)class Comment(db.Model):id = db.Column(db.Integer, primary_key=True)content = db.Column(db.Text, nullable=False)created_at = db.Column(db.DateTime, default=datetime.utcnow)post_id = db.Column(db.Integer, db.ForeignKey('post.id'), nullable=False)user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)

? 第四步:主程序 app.py

# app.py
from flask import Flask
from models import db
from routes import bp
from config import Config
from flask_login import LoginManagerdef create_app():app = Flask(__name__)app.config.from_object(Config)# 初始化數據庫db.init_app(app)# 創建 instance 文件夾和數據庫import osif not os.path.exists('instance'):os.makedirs('instance')with app.app_context():db.create_all()# 初始化登錄管理login_manager = LoginManager()login_manager.login_view = 'bp.login'login_manager.init_app(app)from models import User@login_manager.user_loaderdef load_user(user_id):return User.query.get(int(user_id))# 注冊藍圖app.register_blueprint(bp)return appif __name__ == '__main__':app = create_app()app.run(debug=True)

? 第五步:路由與控制器 routes.py

# routes.py
from flask import Blueprint, render_template, request, redirect, url_for, flash, session
from flask_login import login_user, logout_user, login_required, current_user
from models import db, User, Post, Category, Tag, Comment
from werkzeug.security import generate_password_hash, check_password_hashbp = Blueprint('bp', __name__)@bp.route('/')
def index():search = request.args.get('q')if search:posts = Post.query.filter((Post.title.contains(search)) | (Post.content.contains(search))).order_by(Post.created_at.desc()).all()else:posts = Post.query.order_by(Post.created_at.desc()).all()categories = Category.query.all()return render_template('index.html', posts=posts, categories=categories)@bp.route('/post/<int:id>')
def post(id):post = Post.query.get_or_404(id)return render_template('post.html', post=post)@bp.route('/post/create', methods=['GET', 'POST'])
@login_required
def create_post():if request.method == 'POST':title = request.form['title']content = request.form['content']category_id = request.form.get('category_id')tag_names = request.form.get('tags', '').split(',')# 獲取或創建分類category = Noneif category_id:category = Category.query.get(category_id)# 處理標簽tags = []for name in tag_names:name = name.strip()if name:tag = Tag.query.filter_by(name=name).first()if not tag:tag = Tag(name=name)db.session.add(tag)tags.append(tag)post = Post(title=title,content=content,category=category,tags=tags,author=current_user)db.session.add(post)db.session.commit()flash('文章發布成功!')return redirect(url_for('bp.index'))categories = Category.query.all()return render_template('create_post.html', categories=categories)@bp.route('/post/<int:id>/edit', methods=['GET', 'POST'])
@login_required
def edit_post(id):post = Post.query.get_or_404(id)if post.author != current_user:flash('你沒有權限編輯此文章。')return redirect(url_for('bp.post', id=id))if request.method == 'POST':post.title = request.form['title']post.content = request.form['content']post.category_id = request.form.get('category_id')# 更新標簽tag_names = request.form.get('tags', '').split(',')post.tags.clear()for name in tag_names:name = name.strip()if name:tag = Tag.query.filter_by(name=name).first()if not tag:tag = Tag(name=name)db.session.add(tag)post.tags.append(tag)db.session.commit()flash('文章已更新!')return redirect(url_for('bp.post', id=id))categories = Category.query.all()tag_str = ', '.join([t.name for t in post.tags])return render_template('create_post.html', post=post, categories=categories, tag_str=tag_str)@bp.route('/post/<int:id>/delete', methods=['POST'])
@login_required
def delete_post(id):post = Post.query.get_or_404(id)if post.author != current_user:flash('你沒有權限刪除此文章。')return redirect(url_for('bp.post', id=id))db.session.delete(post)db.session.commit()flash('文章已刪除。')return redirect(url_for('bp.index'))@bp.route('/comment/<int:post_id>', methods=['POST'])
@login_required
def add_comment(post_id):content = request.form['content']post = Post.query.get_or_404(post_id)comment = Comment(content=content, post=post, author=current_user)db.session.add(comment)db.session.commit()flash('評論已發布!')return redirect(url_for('bp.post', id=post_id))@bp.route('/login', methods=['GET', 'POST'])
def login():if request.method == 'POST':username = request.form['username']password = request.form['password']user = User.query.filter_by(username=username).first()if user and check_password_hash(user.password, password):login_user(user)flash('登錄成功!')return redirect(url_for('bp.index'))else:flash('用戶名或密碼錯誤。')return render_template('login.html')@bp.route('/register', methods=['GET', 'POST'])
def register():if request.method == 'POST':username = request.form['username']password = request.form['password']if User.query.filter_by(username=username).first():flash('用戶名已存在。')else:hashed = generate_password_hash(password)user = User(username=username, password=hashed)db.session.add(user)db.session.commit()flash('注冊成功,請登錄。')return redirect(url_for('bp.login'))return render_template('register.html')@bp.route('/logout')
@login_required
def logout():logout_user()flash('已退出登錄。')return redirect(url_for('bp.index'))

? 第六步:HTML 模板

1. 基礎布局 templates/base.html

<!DOCTYPE html>
<html lang="zh">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>{% block title %}我的博客{% endblock %}</title><link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body><header><h1><a href="{{ url_for('bp.index') }}">我的博客</a></h1><nav>{% if current_user.is_authenticated %}<span>歡迎, {{ current_user.username }}!</span><a href="{{ url_for('bp.create_post') }}">發布文章</a><a href="{{ url_for('bp.logout') }}">退出</a>{% else %}<a href="{{ url_for('bp.login') }}">登錄</a><a href="{{ url_for('bp.register') }}">注冊</a>{% endif %}</nav></header><main>{% with messages = get_flashed_messages() %}{% if messages %}<ul class="flashes">{% for message in messages %}<li>{{ message }}</li>{% endfor %}</ul>{% endif %}{% endwith %}{% block content %}{% endblock %}</main><footer><p>&copy; 2025 我的博客系統</p></footer>
</body>
</html>

2. 首頁 templates/index.html

<!-- templates/index.html -->
{% extends "base.html" %}{% block content %}
<h2>文章列表</h2><!-- 搜索框 -->
<form method="get" class="search-form"><input type="text" name="q" placeholder="搜索文章..." value="{{ request.args.get('q', '') }}"><button type="submit">搜索</button>
</form><!-- 文章列表 -->
{% for post in posts %}
<article class="post-preview"><h3><a href="{{ url_for('bp.post', id=post.id) }}">{{ post.title }}</a></h3><p class="meta">發布于 {{ post.created_at.strftime('%Y-%m-%d %H:%M') }}{% if post.category %} | 分類: {{ post.category.name }}{% endif %}</p><p>{{ post.content[:200] }}...</p>{% if post.tags %}<div class="tags">{% for tag in post.tags %}<span class="tag">{{ tag.name }}</span>{% endfor %}</div>{% endif %}
</article>
{% else %}
<p>暫無文章。</p>
{% endfor %}
{% endblock %}

3. 文章詳情 templates/post.html

<!-- templates/post.html -->
{% extends "base.html" %}{% block content %}
<article class="post"><h1>{{ post.title }}</h1><p class="meta">作者: {{ post.author.username }} |發布于 {{ post.created_at.strftime('%Y-%m-%d %H:%M') }}{% if post.category %} | 分類: {{ post.category.name }}{% endif %}</p><div class="content">{{ post.content }}</div>{% if post.tags %}<div class="tags">{% for tag in post.tags %}<span class="tag">{{ tag.name }}</span>{% endfor %}</div>{% endif %}<!-- 編輯/刪除 -->{% if current_user.is_authenticated and current_user == post.author %}<p><a href="{{ url_for('bp.edit_post', id=post.id) }}">編輯</a> |<a href="#" onclick="if(confirm('確定刪除?')) document.getElementById('delete-form').submit()">刪除</a></p><form id="delete-form" action="{{ url_for('bp.delete_post', id=post.id) }}" method="post" style="display:none;"></form>{% endif %}<!-- 評論 --><h3>評論 ({{ post.comments|length }})</h3>{% if current_user.is_authenticated %}<form method="post" action="{{ url_for('bp.add_comment', post_id=post.id) }}"><textarea name="content" placeholder="寫下你的評論..." required></textarea><button type="submit">發表評論</button></form>{% else %}<p><a href="{{ url_for('bp.login') }}">登錄</a>后可發表評論。</p>{% endif %}{% for comment in post.comments %}<div class="comment"><strong>{{ comment.author.username }}</strong><span class="date">{{ comment.created_at.strftime('%Y-%m-%d %H:%M') }}</span><p>{{ comment.content }}</p></div>{% endfor %}
</article>
{% endblock %}

4. 發布/編輯文章 templates/create_post.html

<!-- templates/create_post.html -->
{% extends "base.html" %}{% block content %}
<h2>{% if post %}編輯文章{% else %}發布新文章{% endif %}</h2><form method="post"><label>標題 *</label><input type="text" name="title" value="{{ post.title if post }}" required><label>內容 *</label><textarea name="content" rows="10" required>{{ post.content if post }}</textarea><label>分類</label><select name="category_id"><option value="">無分類</option>{% for cat in categories %}<option value="{{ cat.id }}" {% if post and post.category_id == cat.id %}selected{% endif %}>{{ cat.name }}</option>{% endfor %}</select><label>標簽(多個用逗號分隔)</label><input type="text" name="tags" value="{{ tag_str if tag_str else '' }}" placeholder="如:Python,Flask"><button type="submit">{% if post %}更新文章{% else %}發布文章{% endif %}</button>
</form><a href="{{ url_for('bp.index') }}">返回首頁</a>
{% endblock %}

6. 注冊頁 templates/register.html

<!-- templates/register.html -->
{% extends "base.html" %}{% block content %}
<h2>注冊</h2>
<form method="post"><label>用戶名 *</label><input type="text" name="username" required><label>密碼 *</label><input type="password" name="password" required><button type="submit">注冊</button>
</form>
<p>已有賬號?<a href="{{ url_for('bp.login') }}">去登錄</a></p>
{% endblock %}

? 第七步:CSS 樣式 static/style.css

/* static/style.css */
* {margin: 0;padding: 0;box-sizing: border-box;
}body {font-family: Arial, sans-serif;line-height: 1.6;color: #333;max-width: 800px;margin: 0 auto;padding: 20px;
}header {display: flex;justify-content: space-between;align-items: center;padding-bottom: 20px;border-bottom: 1px solid #eee;margin-bottom: 30px;
}header h1 a {text-decoration: none;color: #0056b3;
}nav a {margin-left: 15px;color: #0056b3;text-decoration: none;
}nav a:hover {text-decoration: underline;
}.flashes {background: #d4edda;color: #155724;padding: 10px;border-radius: 4px;margin-bottom: 20px;
}.post-preview {margin-bottom: 30px;padding-bottom: 20px;border-bottom: 1px solid #eee;
}.post-preview h3 {margin-bottom: 5px;
}.post-preview h3 a {color: #0056b3;text-decoration: none;
}.meta {color: #666;font-size: 0.9em;margin-bottom: 10px;
}.tags {margin-top: 10px;
}.tag {display: inline-block;background: #0056b3;color: white;padding: 2px 8px;border-radius: 12px;font-size: 0.8em;margin-right: 5px;
}form {margin: 20px 0;
}label {display: block;margin: 10px 0 5px;font-weight: bold;
}input[type="text"], input[type="password"], textarea, select {width: 100%;padding: 8px;border: 1px solid #ddd;border-radius: 4px;
}button {background: #0056b3;color: white;padding: 10px 15px;border: none;border-radius: 4px;cursor: pointer;margin-top: 10px;
}button:hover {background: #003d82;
}.search-form {display: flex;margin-bottom: 30px;
}.search-form input {flex: 1;margin-right: 10px;
}.comment {border: 1px solid #eee;padding: 10px;margin-bottom: 10px;border-radius: 4px;
}.comment .date {color: #666;font-size: 0.8em;margin-left: 10px;
}footer {text-align: center;margin-top: 50px;color: #666;font-size: 0.9em;
}

? 第八步:運行項目

  1. 確保你在 blog 目錄下
  2. 運行:
python app.py

瀏覽器訪問:http://127.0.0.1:5000

? 第九步:使用說明

  1. 訪問 /register 注冊一個賬號
  2. 登錄后即可發布文章
  3. 支持分類、標簽、搜索、評論
  4. 只有作者可編輯/刪除自己的文章

? 學習要點總結

概念項目中體現
MVCmodels.py(M) + routes.py(C) + templates/(V)
數據庫操作SQLAlchemy ORM 實現增刪改查
會話管理Flask-Login 處理登錄狀態
表單處理request.form 獲取數據
模板渲染Jinja2 動態生成 HTML

? 后續建議

  • 添加 Markdown 支持
  • 增加分頁
  • 使用 Bootstrap 美化界面
  • 部署到云端(如 Render.com)

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/pingmian/96206.shtml
繁體地址,請注明出處:http://hk.pswp.cn/pingmian/96206.shtml
英文地址,請注明出處:http://en.pswp.cn/pingmian/96206.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

基于RFID技術的寵物自動喂食器方案

一、背景 寵物已經成為現代人生活中不可或缺的一部分&#xff0c;隨著養寵物的人越來越多&#xff0c;寵物的數量也越來越多&#xff0c;有些家庭甚至養了兩只以上的貓狗或者貓狗混養&#xff0c;寵物間的管理問題也越來越突出&#xff0c;如寵物之間的搶食行為&#xff0c;易…

conda常見問題

文章目錄run "conda init" before "conda activate"打開PowerShell自動進入base環境&#xff08;cmd沒有這個問題&#xff09;run “conda init” before “conda activate” 在使用conda命令創建env后使用conda activate命令&#xff0c;出現"run ‘…

第5章 HTTPS與安全配置

5.1 HTTPS概述 5.1.1 為什么需要HTTPS 數據加密:保護傳輸中的敏感數據 身份驗證:確認服務器身份的真實性 數據完整性:防止數據在傳輸過程中被篡改 SEO優勢:搜索引擎優先排名HTTPS網站 瀏覽器要求:現代瀏覽器對HTTP網站顯示不安全警告 合規要求:許多行業標準要求使用HTTP…

Java入門級教程17——利用Java SPI機制制作驗證碼、利用Java RMI機制實現分布式登錄驗證系統

目錄 1.制作驗證碼——java SPI機制 1.1 類所屬包情況 1.2 具體實現 1.2.1 核心接口&#xff1a;ICode 1.2.2 接口實現類&#xff1a;驗證碼的具體生成邏輯 1.2.3 服務工廠類&#xff1a;CodeServiceFactory&#xff08;核心&#xff1a;SPI 服務發現&#xff09; 1.2.…

ES6筆記5

1. Promise相當于一個容器&#xff0c;保存著未來才要結束的事件&#xff08;異步操作&#xff09;的一個結果&#xff0c;各種異步操作都可以用同樣方法處理 axios特點&#xff1a;對象的狀態不受外界影響&#xff0c;處理異步操作&#xff0c;3個狀態&#xff0c;Pending&…

解決idea2021maven依賴導入后還是找不到包,爆紅無法導入

1.依賴導入后pom.xml文件以及Maven,此兩處代碼還是爆紅 2.解決方法 由技術大佬同事幾分鐘解決,他記憶深刻之前搞過很久,一看就知道哪里出問題了 我之前是配過Maven的本地倉庫的但是沒有用,這次出問題之后長教訓了,技術大佬說盡量用自己的本地倉庫,不要用idea的Maven倉庫,容易…

【硬件-筆試面試題-81】硬件/電子工程師,筆試面試題(知識點:詳細講講同步時鐘與異步時鐘通信)

題目匯總版--鏈接&#xff1a; 【硬件-筆試面試題】硬件/電子工程師&#xff0c;筆試面試題匯總版&#xff0c;持續更新學習&#xff0c;加油&#xff01;&#xff01;&#xff01;-CSDN博客 【硬件-筆試面試題-81】硬件/電子工程師&#xff0c;筆試面試題&#xff08;知識點…

php計算一個模擬增長過程函數

private function calculateGrowth($progress) {// 使用多個增長階段模擬不均勻性if ($progress < 0.3) {// 前30%時間&#xff1a;緩慢增長 30 %return pow($progress / 0.3, 0.7) * 0.3;} elseif ($progress < 0.7) {// 中間40%時間&#xff1a;快速增長 50%return 0.3…

華為USG6000v2 NAT模式下IPSEC IKE V1 實驗

USG6000v2 NAT模式下IPSEC 實驗 拓撲圖公網配置OSPF路由協議&#xff08;網絡要求能通就行&#xff09; 一、 總部配置 &#xff08;一&#xff09;交換機配置 1、 總部交換機到防火墻網段 192.168.10.0/24 2、 交換機G0/0設置成access端口劃分vlan 10&#xff0c;網關 192.168…

android 里設計context的作用

Android中的Context是一個核心設計機制&#xff0c;其作用主要體現在以下幾個方面&#xff1a; 1. 提供應用程序環境信息 Context作為抽象類&#xff0c;封裝了應用與系統交互所需的全局環境信息&#xff0c;包括資源訪問、組件啟動、系統服務調用等基礎能力。它本質上是應用…

能發彈幕的簡單視頻網站

界面參考了Youtube&#xff0c;后端使用Spring Boot&#xff0c;前端Vue&#xff0c;vuetifyjs。支持自動生成封面圖&#xff0c;發送彈幕、AI內容審核等功能。 一個簡單的視頻網站 網站名稱是 TikTok 與 YouTube 的縫合&#xff0c;Logo 為豆包 AI 生成 主要界面參考了 Yout…

了解網站安全監測系統的重要性

在當今數字化時代&#xff0c;網站已經成為企業發展和品牌推廣的關鍵渠道之一。然而&#xff0c;隨之而來的是網絡安全威脅的增加&#xff0c;包括數據泄露、惡意攻擊和病毒感染等問題。為了保護網站和用戶信息的安全&#xff0c;網站安全監測系統變得至關重要。1. 網站安全監測…

fastadmin安裝后后臺提示putenv()報錯,不顯示驗證碼

1.安裝fastadmin后&#xff0c;訪問項目后臺&#xff0c;提示報錯&#xff1a;Warning: putenv() has been disabled for security reasons in /www/wwwroot/app.aaa.cn/thinkphp/base.php on line 50 這時候驗證碼還不顯示&#xff0c;怎么解決呢&#xff1f;2.打開php.ini文件…

C語言深度入門系列:第二篇 - 變量與數據類型:程序世界的基本粒子與容器

C語言深度入門系列&#xff1a;第二篇 - 變量與數據類型&#xff1a;程序世界的基本粒子與容器 本章目標 本章將深入探討程序如何“記住”信息。你將徹底理解變量的本質是內存中的一塊空間&#xff0c;數據類型是解釋這塊內存中0和1的規則。我們將超越簡單的int, float用法&…

十一旅游中國氣象攻略:如何評估降雨、大風與紫外線

一、十一期間的中國氣候態要點(10 月上旬) 冷空氣南下增多:華北—東北易大風降溫;長江以南易出現冷暖空氣交匯降雨。 臺風未完全退場:華南沿海與海南、華東沿海仍可能受外圍環流與風雨影響。 晝夜溫差擴大:西北、華北、內陸盆地早晚涼,白天熱,霧/霜風險抬頭。 高原與…

鴻蒙項目篇-21-創建項目、修改軟件文字/圖標

目錄 【預覽】修改配置文件 module.json5 創建項目 初次-運行預覽 拷貝圖片 用于替換 【實操】修改配置文件 module.json5 點擊,顯示引用 ctrl + 點擊,引用追蹤 置頂模擬器 最終代碼 總結 先規劃再行動【高效】以終為始【不偏離方向/目標】 【預覽】修改配置文件 m…

Linux服務器的系統安全強化超詳細教程

Linux服務器幾乎承擔著最重要的計算和存儲角色&#xff0c;它是企業網站、數據庫、應用中間件、開發環境乃至云原生容器平臺的核心。正因為Linux服務器的廣泛應用&#xff0c;它也成為攻擊者頻繁鎖定的目標。系統一旦被攻破&#xff0c;不僅業務會面臨中斷&#xff0c;更嚴重的…

計算機畢設 java 高校會議室預約管理系統 基于 SSM 框架的高校會議室管理平臺 Java+MySQL 的預約全流程管控系統

計算機畢設java高校會議室預約管理系統z14559 &#xff08;配套有源碼 程序 mysql數據庫 論文&#xff09;本套源碼可以先看具體功能演示視頻領取&#xff0c;文末有聯xi 可分享在高校會議室資源緊張的背景下&#xff0c;傳統預約依賴人工登記、信息傳遞滯后&#xff0c;存在預…

Redis的持久化機制RDB和AOF詳解

本文為您介紹redis的持久化機制以及持久化的選型。 目錄 持久化策略 RDB(RedisDatabase)快照 AOF(Append Only File) 混合持久化策略 RDB與AOF對比 持久化策略使用建議 Redis數據備份策略建議 補充知識 save與bgsave對比 bgsave的寫時復制(COW)機制 持久化策略 Red…

Vue 3 實戰:從零到一用 vue-pdf-embed 打造功能齊全的 PDF 查看器

你好&#xff0c;Vue 開發者們&#xff01; 在 Web 開發中&#xff0c;我們經常會遇到需要在頁面中直接展示 PDF 文件的需求&#xff0c;例如預覽合同、顯示報告或在線閱讀文檔。你可能會想到用 <iframe> 或者一些重量級的庫&#xff0c;但它們往往不夠靈活或過于臃腫。…