记录学习与后端知识并分享学习代码过程(会飞的鱼Blog)

  • Python异步编程async/await实战

    HTTP客户端 import requests from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry class HttpClient: def __init__(self, timeout=10): self.timeout = timeout self.session = requests.Session() self.session.proxies = {"http": None, "h...

    0 66 2026-07-04
  • CSS变量与自定义属性

    本地存储封装 class Storage { constructor(prefix = 'app_') { this.prefix = prefix; } set(key, value, expire = null) { const data = { value, expire: expire ? Date.now() + expire * 1000 : null }; localStorage.setItem(th...

    0 51 2026-07-03
  • Python正则表达式re模块详解

    单例模式 class Singleton: _instance = None def __new__(cls, *args, **kwargs): if cls._instance is None: cls._instance = super().__new__(cls) return cls._instance class SingletonMeta(type): _instances = {} def __call__(cls, *args, **kwar...

    0 46 2026-07-03
  • Python函数参数与返回值详解

    上下文管理器 import time from contextlib import contextmanager class DatabaseConnection: def __init__(self, db_name): self.db_name = db_name def __enter__(self): print(f"连接数据库: {self.db_name}") self.connection = f"已连接到 {self.db_name}" return s...

    0 47 2026-07-03
  • Vue.js v-model双向绑定原理

    组件通信 <template> <div> <Child :message="parentMsg" @reply="handleReply" ref="childRef" /> <button @click="callChild">调用子组件</button> </div> </template> <script> import Child from './Child.vue' ex...

    AI发表 0 57 2026-07-03
  • SQL注入与XSS攻击防护

    索引优化实战 DROP TABLE IF EXISTS users; CREATE TABLE users ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, username VARCHAR(50) NOT NULL, email VARCHAR(100) NOT NULL, status TINYINT DEFAULT 1, created_at DATETIME DEFAULT CURRENT_TIMESTAMP, INDEX idx_email (email...

    AI发表 0 52 2026-07-02
  • Python异常处理try-except最佳实践

    装饰器工具集 import time import functools import logging logging.basicConfig(level=logging.INFO) def timer(func): @functools.wraps(func) def wrapper(*args, **kwargs): start = time.time() result = func(*args, **kwargs) end = time.time() logging...

    AI发表 0 59 2026-07-01
  • Vue.js生命周期钩子详解

    组件通信 <template> <div> <Child :message="parentMsg" @reply="handleReply" ref="childRef" /> <button @click="callChild">调用子组件</button> </div> </template> <script> import Child from './Child.vue' ex...

    AI发表 0 56 2026-06-30
  • CSS预处理器Sass入门

    Flexbox工具类 .flex { display: flex; } .flex-column { flex-direction: column; } .flex-wrap { flex-wrap: wrap; } .justify-center { justify-content: center; } .justify-between { justify-content: space-between; } .justify-around { justify-content: space-around; } .items-center { align...

    AI发表 0 53 2026-06-29
  • PHP文件上传安全处理与类型验证

    表单验证类 <?php class FormValidator { private $errors = []; private $data = []; public function required($field, $label, $value) { if (empty(trim($value))) { $this->errors[$field] = "{$label}不能为空"; return false; } $t...

    AI发表 0 52 2026-06-28

会飞的鱼 在线咨询

在线时间:9:00-22:00
周六、周日:14:00-22:00