当前位置:首页>php>PHP 系列教程·入门完结篇

PHP 系列教程·入门完结篇

  • 2026-04-17 07:41:14
PHP 系列教程·入门完结篇

前面的内容学完后,你已经能做出用户注册和展示的功能了。但还有一个关键问题没解决:用户注册后,每次访问网站都要重新输入用户名密码吗?怎么让网站“记住”用户已经登录了?

这就涉及到会话管理。这一部分我们学习Cookie和Session,并用它们实现完整的用户登录、退出、登录状态保持功能。

---

一、Cookie vs Session:两种“记住”方式

HTTP协议本身是“无状态”的——服务器处理完一个请求就会忘记你是谁。Cookie和Session就是解决这个问题的两种方案。

特性 Cookie Session
数据存储位置 浏览器端 服务器端
存储大小限制 约4KB 无固定限制(受服务器内存/配置影响)
安全性 较低(数据可被用户查看和修改) 较高(数据在服务器端)
生命周期 可设置过期时间 通常随浏览器关闭而结束
适用场景 记住偏好设置、自动登录 登录状态、购物车、敏感数据

简单理解:

· Cookie就像商场给你的会员卡,卡上写着你的信息(存在你手里)
· Session就像商场后台的顾客档案,你手里的会员卡只存了一个编号(Session ID),具体信息存在商场那边

实际应用中,两者经常配合使用:Session ID存放在Cookie中,实际数据存在服务器上。

---

二、Cookie的使用

2.1 设置Cookie

```php
<?php
// setcookie(名称, 值, 过期时间, 路径, 域名, 安全标志, HttpOnly)

// 基础用法:设置一个名为username的cookie,有效期1小时
setcookie("username", "张三", time() + 3600);

// 设置路径:只在 /user/ 目录下有效
setcookie("preference", "dark_mode", time() + 86400, "/user/");

// 设置HttpOnly(禁止JavaScript读取,提高安全性)
setcookie("session_id", "abc123", time() + 3600, "/", "", false, true);
?>
```

重要: setcookie() 必须在任何HTML输出之前调用,否则会报错。

```php
<?php
// 正确写法
setcookie("username", "张三", time() + 3600);
?>
<!DOCTYPE html>
<html>
<body>
    <p>Cookie已设置</p>
</body>
</html>
```

2.2 读取Cookie

```php
<?php
// 判断cookie是否存在
if (isset($_COOKIE["username"])) {
    echo "欢迎回来," . htmlspecialchars($_COOKIE["username"]);
} else {
    echo "未检测到登录信息";
}
?>
```

2.3 删除Cookie

把过期时间设置为过去的时间即可:

```php
<?php
setcookie("username", "", time() - 3600);  // 设置为1小时前过期
?>
```

---

三、Session的使用

Session是PHP内置的会话管理机制,使用前需要先启动。

3.1 启动Session

```php
<?php
session_start();  // 必须在任何输出之前调用
?>
```

session_start() 会做两件事:

1. 检查浏览器是否携带了Session ID(通过Cookie)
2. 如果没有,创建一个新的Session ID,并通过Cookie发送给浏览器

3.2 存储和读取Session数据

```php
<?php
session_start();

// 存储数据到Session
$_SESSION["user_id"] = 1001;
$_SESSION["username"] = "张三";
$_SESSION["login_time"] = time();

// 读取Session数据
if (isset($_SESSION["username"])) {
    echo "当前登录用户:" . $_SESSION["username"];
}

// 查看所有Session数据
echo "<pre>";
print_r($_SESSION);
echo "</pre>";
?>
```

3.3 删除Session数据

```php
<?php
session_start();

// 删除单个Session变量
unset($_SESSION["username"]);

// 删除所有Session变量(清空)
$_SESSION = [];

// 销毁整个Session(包括Session ID)
session_destroy();
?>
```

注意:session_destroy() 只会销毁服务器端的Session文件,但浏览器端的Session ID Cookie还在。通常需要配合 setcookie() 删除那个Cookie。

---

四、完整案例:用户登录系统

现在我们结合前面的用户注册、数据库操作,来实现一个完整的登录系统。

4.1 项目结构

```
login_system/
├── config/
│   └── database.php      # 数据库配置
├── includes/
│   ├── header.php        # 页面头部
│   ├── footer.php        # 页面底部
│   └── auth.php          # 登录检查函数
├── index.php             # 首页(根据登录状态显示不同内容)
├── register.php          # 注册处理
├── login.php             # 登录处理
├── logout.php            # 退出处理
└── profile.php           # 个人中心(需登录才能访问)
```

4.2 数据库准备

在之前的 users 表基础上,增加密码加密字段。注意:密码绝对不能明文存储。

```sql
-- 如果已有表,删除重建(开发环境)
DROP TABLE IF EXISTS users;
CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    username VARCHAR(50) NOT NULL UNIQUE,
    password VARCHAR(255) NOT NULL,  -- 存储加密后的密码
    email VARCHAR(100),
    gender VARCHAR(10),
    city VARCHAR(50),
    bio TEXT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    last_login TIMESTAMP NULL
);
```

4.3 配置文件

config/database.php:

```php
<?php
$db_host = "localhost";
$db_user = "root";
$db_password = "";
$db_name = "login_system";

$conn = new mysqli($db_host, $db_user, $db_password, $db_name);

if ($conn->connect_error) {
    die("数据库连接失败:" . $conn->connect_error);
}

$conn->set_charset("utf8mb4");
?>
```

4.4 登录检查函数

includes/auth.php:

```php
<?php
/**
* 检查用户是否已登录
* @return bool 已登录返回true,否则返回false
*/
function isLoggedIn() {
    session_start();
    return isset($_SESSION["user_id"]) && isset($_SESSION["username"]);
}

/**
* 获取当前登录用户信息
* @return array|null 用户信息数组,未登录返回null
*/
function getCurrentUser() {
    if (!isLoggedIn()) {
        return null;
    }
   
    return [
        "id" => $_SESSION["user_id"],
        "username" => $_SESSION["username"],
        "email" => $_SESSION["email"] ?? ""
    ];
}

/**
* 要求用户必须登录,未登录则跳转到登录页
*/
function requireLogin() {
    if (!isLoggedIn()) {
        header("Location: login.php");
        exit;
    }
}

/**
* 记录登录状态到Session
* @param array $user 用户数据(从数据库查出的)
*/
function setUserSession($user) {
    session_start();
    $_SESSION["user_id"] = $user["id"];
    $_SESSION["username"] = $user["username"];
    $_SESSION["email"] = $user["email"] ?? "";
    // 可以继续添加其他不敏感的信息
}

/**
* 清除登录状态
*/
function logout() {
    session_start();
    $_SESSION = [];
    session_destroy();
   
    // 删除Session Cookie
    if (ini_get("session.use_cookies")) {
        $params = session_get_cookie_params();
        setcookie(session_name(), '', time() - 42000,
            $params["path"], $params["domain"],
            $params["secure"], $params["httponly"]
        );
    }
}
?>
```

4.5 注册功能(密码加密)

register.php:

```php
<?php
require_once "config/database.php";

$error = "";
$success = "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $username = trim($_POST["username"] ?? "");
    $password = $_POST["password"] ?? "";
    $confirm_password = $_POST["confirm_password"] ?? "";
    $email = trim($_POST["email"] ?? "");
    $gender = $_POST["gender"] ?? "";
    $city = $_POST["city"] ?? "";
    $bio = trim($_POST["bio"] ?? "");
   
    // 验证
    if (strlen($username) < 3) {
        $error = "用户名至少需要3个字符";
    } elseif (strlen($password) < 6) {
        $error = "密码至少需要6个字符";
    } elseif ($password !== $confirm_password) {
        $error = "两次输入的密码不一致";
    } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $error = "邮箱格式不正确";
    } else {
        // 密码加密(使用PHP内置的password_hash)
        $hashedPassword = password_hash($password, PASSWORD_DEFAULT);
       
        // 检查用户名是否已存在
        $checkSql = "SELECT id FROM users WHERE username = ?";
        $checkStmt = $conn->prepare($checkSql);
        $checkStmt->bind_param("s", $username);
        $checkStmt->execute();
        $checkStmt->store_result();
       
        if ($checkStmt->num_rows > 0) {
            $error = "用户名已被占用";
        } else {
            // 插入新用户
            $sql = "INSERT INTO users (username, password, email, gender, city, bio)
                    VALUES (?, ?, ?, ?, ?, ?)";
            $stmt = $conn->prepare($sql);
            $stmt->bind_param("ssssss", $username, $hashedPassword, $email, $gender, $city, $bio);
           
            if ($stmt->execute()) {
                $success = "注册成功!<a href='login.php'>去登录</a>";
            } else {
                $error = "注册失败:" . $stmt->error;
            }
            $stmt->close();
        }
        $checkStmt->close();
    }
}
?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>用户注册</title>
    <style>
        .error { color: red; }
        .success { color: green; }
        input, select, textarea { margin-bottom: 10px; }
    </style>
</head>
<body>
    <h2>用户注册</h2>
   
    <?php if ($error): ?>
        <p class="error"><?php echo htmlspecialchars($error); ?></p>
    <?php endif; ?>
   
    <?php if ($success): ?>
        <p class="success"><?php echo $success; ?></p>
    <?php else: ?>
        <form method="post">
            <div>
                <label>用户名:</label>
                <input type="text" name="username" required minlength="3">
            </div>
            <div>
                <label>密码:</label>
                <input type="password" name="password" required minlength="6">
            </div>
            <div>
                <label>确认密码:</label>
                <input type="password" name="confirm_password" required>
            </div>
            <div>
                <label>邮箱:</label>
                <input type="email" name="email">
            </div>
            <div>
                <label>性别:</label>
                <input type="radio" name="gender" value="男"> 男
                <input type="radio" name="gender" value="女"> 女
            </div>
            <div>
                <label>城市:</label>
                <select name="city">
                    <option value="">请选择</option>
                    <option value="北京">北京</option>
                    <option value="上海">上海</option>
                    <option value="广州">广州</option>
                    <option value="深圳">深圳</option>
                </select>
            </div>
            <div>
                <label>个人简介:</label><br>
                <textarea name="bio" rows="5" cols="40"></textarea>
            </div>
            <div>
                <input type="submit" value="注册">
            </div>
        </form>
    <?php endif; ?>
   
    <p><a href="login.php">已有账号?去登录</a></p>
</body>
</html>
```

4.6 登录功能

login.php:

```php
<?php
require_once "config/database.php";
require_once "includes/auth.php";

// 如果已经登录,直接跳转到首页
if (isLoggedIn()) {
    header("Location: index.php");
    exit;
}

$error = "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $username = trim($_POST["username"] ?? "");
    $password = $_POST["password"] ?? "";
   
    if (empty($username) || empty($password)) {
        $error = "用户名和密码不能为空";
    } else {
        // 从数据库查询用户
        $sql = "SELECT id, username, password, email FROM users WHERE username = ?";
        $stmt = $conn->prepare($sql);
        $stmt->bind_param("s", $username);
        $stmt->execute();
        $result = $stmt->get_result();
       
        if ($row = $result->fetch_assoc()) {
            // 验证密码(使用password_verify)
            if (password_verify($password, $row["password"])) {
                // 密码正确,设置Session
                setUserSession($row);
               
                // 更新最后登录时间
                $updateSql = "UPDATE users SET last_login = NOW() WHERE id = ?";
                $updateStmt = $conn->prepare($updateSql);
                $updateStmt->bind_param("i", $row["id"]);
                $updateStmt->execute();
                $updateStmt->close();
               
                // 跳转到首页
                header("Location: index.php");
                exit;
            } else {
                $error = "密码错误";
            }
        } else {
            $error = "用户名不存在";
        }
        $stmt->close();
    }
}
?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>用户登录</title>
    <style>
        .error { color: red; }
        input { margin-bottom: 10px; }
    </style>
</head>
<body>
    <h2>用户登录</h2>
   
    <?php if ($error): ?>
        <p class="error"><?php echo htmlspecialchars($error); ?></p>
    <?php endif; ?>
   
    <form method="post">
        <div>
            <label>用户名:</label>
            <input type="text" name="username" required>
        </div>
        <div>
            <label>密码:</label>
            <input type="password" name="password" required>
        </div>
        <div>
            <input type="submit" value="登录">
        </div>
    </form>
   
    <p><a href="register.php">没有账号?去注册</a></p>
</body>
</html>
```

4.7 退出功能

logout.php:

```php
<?php
require_once "includes/auth.php";
logout();
header("Location: login.php");
exit;
?>
```

4.8 首页(根据登录状态显示不同内容)

index.php:

```php
<?php
require_once "includes/auth.php";
require_once "config/database.php";
?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>首页</title>
</head>
<body>
    <?php if (isLoggedIn()): ?>
        <?php $user = getCurrentUser(); ?>
        <h1>欢迎回来,<?php echo htmlspecialchars($user["username"]); ?>!</h1>
        <p>邮箱:<?php echo htmlspecialchars($user["email"]); ?></p>
        <p><a href="profile.php">个人中心</a> | <a href="logout.php">退出登录</a></p>
       
        <hr>
        <h3>用户列表</h3>
        <?php
        $sql = "SELECT id, username, email, created_at FROM users ORDER BY id DESC LIMIT 20";
        $result = $conn->query($sql);
       
        if ($result->num_rows > 0):
        ?>
        <table border="1" cellpadding="8">
            <tr>
                <th>ID</th>
                <th>用户名</th>
                <th>邮箱</th>
                <th>注册时间</th>
            </tr>
            <?php while ($row = $result->fetch_assoc()): ?>
            <tr>
                <td><?php echo $row["id"]; ?></td>
                <td><?php echo htmlspecialchars($row["username"]); ?></td>
                <td><?php echo htmlspecialchars($row["email"]); ?></td>
                <td><?php echo $row["created_at"]; ?></td>
            </tr>
            <?php endwhile; ?>
        </table>
        <?php else: ?>
            <p>暂无用户</p>
        <?php endif; ?>
       
    <?php else: ?>
        <h1>欢迎访问</h1>
        <p>请先<a href="login.php">登录</a>或<a href="register.php">注册</a></p>
    <?php endif; ?>
   
    <?php $conn->close(); ?>
</body>
</html>
```

4.9 个人中心(需登录才能访问)

profile.php:

```php
<?php
require_once "includes/auth.php";
require_once "config/database.php";

// 未登录则跳转到登录页
requireLogin();

$user = getCurrentUser();
$message = "";

// 处理个人信息更新
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["update_profile"])) {
    $email = trim($_POST["email"] ?? "");
    $city = $_POST["city"] ?? "";
    $bio = trim($_POST["bio"] ?? "");
   
    $sql = "UPDATE users SET email = ?, city = ?, bio = ? WHERE id = ?";
    $stmt = $conn->prepare($sql);
    $stmt->bind_param("sssi", $email, $city, $bio, $user["id"]);
   
    if ($stmt->execute()) {
        $message = "个人信息更新成功!";
        // 更新Session中的邮箱
        $_SESSION["email"] = $email;
        $user["email"] = $email;
    } else {
        $message = "更新失败:" . $stmt->error;
    }
    $stmt->close();
}

// 获取完整的用户信息
$sql = "SELECT * FROM users WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $user["id"]);
$stmt->execute();
$fullUser = $stmt->get_result()->fetch_assoc();
$stmt->close();
?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>个人中心</title>
    <style>
        .message { color: green; }
        input, select, textarea { margin-bottom: 10px; }
    </style>
</head>
<body>
    <h1>个人中心</h1>
    <p>欢迎,<?php echo htmlspecialchars($user["username"]); ?>!</p>
   
    <?php if ($message): ?>
        <p class="message"><?php echo htmlspecialchars($message); ?></p>
    <?php endif; ?>
   
    <form method="post">
        <div>
            <label>用户名:</label>
            <input type="text" value="<?php echo htmlspecialchars($fullUser["username"]); ?>" disabled>
            <small>用户名不可修改</small>
        </div>
        <div>
            <label>邮箱:</label>
            <input type="email" name="email" value="<?php echo htmlspecialchars($fullUser["email"] ?? ""); ?>">
        </div>
        <div>
            <label>性别:</label>
            <input type="text" value="<?php echo htmlspecialchars($fullUser["gender"] ?? ""); ?>" disabled>
        </div>
        <div>
            <label>城市:</label>
            <select name="city">
                <option value="">请选择</option>
                <option value="北京" <?php echo ($fullUser["city"] == "北京") ? "selected" : ""; ?>>北京</option>
                <option value="上海" <?php echo ($fullUser["city"] == "上海") ? "selected" : ""; ?>>上海</option>
                <option value="广州" <?php echo ($fullUser["city"] == "广州") ? "selected" : ""; ?>>广州</option>
                <option value="深圳" <?php echo ($fullUser["city"] == "深圳") ? "selected" : ""; ?>>深圳</option>
            </select>
        </div>
        <div>
            <label>个人简介:</label><br>
            <textarea name="bio" rows="5" cols="40"><?php echo htmlspecialchars($fullUser["bio"] ?? ""); ?></textarea>
        </div>
        <div>
            <input type="submit" name="update_profile" value="保存修改">
        </div>
    </form>
   
    <p>注册时间:<?php echo $fullUser["created_at"]; ?></p>
    <p>最后登录:<?php echo $fullUser["last_login"] ?? "暂无记录"; ?></p>
   
    <p><a href="index.php">返回首页</a> | <a href="logout.php">退出登录</a></p>
</body>
</html>
```

---

五、密码加密详解

5.1 为什么不能明文存储密码

如果数据库被攻击或泄露,明文密码会直接暴露。很多人会在多个网站使用相同密码,后果非常严重。

5.2 PHP的密码加密函数

PHP 提供了专门处理密码的函数,永远不要自己发明加密算法:

```php
<?php
// 加密:生成密码哈希
$hashed = password_hash("用户输入的密码", PASSWORD_DEFAULT);
// 结果类似:$2y$10$...(每次生成的都不一样,因为包含了随机盐)

// 验证:比对用户输入和存储的哈希
if (password_verify("用户输入的密码", $hashed)) {
    echo "密码正确";
} else {
    echo "密码错误";
}

// 检查是否需要重新哈希(升级加密算法时使用)
if (password_needs_rehash($hashed, PASSWORD_DEFAULT)) {
    $newHash = password_hash("密码", PASSWORD_DEFAULT);
    // 更新数据库中的密码
}
?>
```

为什么要用 password_hash()?

· 自动加盐(每个密码使用不同的随机盐)
· 自动选择强算法(目前是 bcrypt)
· 抵抗彩虹表攻击和暴力破解

---

六、常见错误与避坑指南

错误现象 常见原因 解决方法
session_start() 报错 已有输出(空格、HTML、BOM头) 确保 session_start() 在文件最开头,<?php 前无任何字符
Session 数据不保存 未调用 session_start() 每个需要 Session 的页面都要先调用
登录后刷新又变成未登录 Session 路径权限问题 检查 session.save_path 目录是否可写
密码验证总是失败 注册时未用 password_hash 注册时加密,登录时用 password_verify
Cookie 设置不生效 在输出 HTML 之后调用 setcookie() 必须在任何输出之前

---

七、小结

这一部分我们学习了:

知识点 核心内容
Cookie 存储在浏览器端,适合存偏好设置
Session 存储在服务器端,适合存登录状态
密码加密 password_hash() + password_verify()
登录流程 验证用户名密码 → 设置 Session → 跳转
退出流程 清空 Session → 销毁 Session → 删除 Cookie
权限控制 封装 requireLogin() 函数保护需要登录的页面

学完这一部分,你已经能做出一个完整的用户系统:注册、登录、退出、个人中心、权限控制。

---

八、整个教程总结

PHP保姆级教程到此告一段落。我们从零开始,走完了以下内容:

部分 核心内容
第一部分 PHP 是什么、怎么来的、环境搭建、第一个程序
第二部分 变量、数据类型、运算符、字符串拼接
第三部分 条件判断(if/else)、循环(for/while)
第四部分 索引数组、关联数组、多维数组、数组函数
第五部分 函数定义、参数、返回值、作用域、内置函数
第六部分 文件包含、表单处理、数据库连接、增删改查、SQL注入防范
第七部分 Cookie/Session、用户登录、密码加密、权限控制

你现在掌握的技能,已经足够开发一个完整的动态网站了。下一步可以往这些方向深入:

1. 前端补充:HTML/CSS/JavaScript,让你的页面更好看、更交互
2. 框架学习:Laravel、ThinkPHP 等现代 PHP 框架
3. 进阶数据库:多表联查、事务、索引优化
4. 安全知识:XSS、CSRF、SQL注入的更深层防范
5. 项目实战:尝试写一个留言板、博客系统、简单的电商购物车

编程的学习没有终点,重要的是保持动手的习惯。每学一个新知识点,就写一个小程序去验证它。

祝你编码愉快!🌹

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-04-17 12:18:48 HTTP/2.0 GET : https://f.mffb.com.cn/a/485356.html
  2. 运行时间 : 0.146961s [ 吞吐率:6.80req/s ] 内存消耗:4,567.76kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=ff80ce5d1df4afe3ec13e821b883d099
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000434s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000696s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.004553s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000520s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000662s ]
  6. SELECT * FROM `set` [ RunTime:0.000262s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000738s ]
  8. SELECT * FROM `article` WHERE `id` = 485356 LIMIT 1 [ RunTime:0.000815s ]
  9. UPDATE `article` SET `lasttime` = 1776399529 WHERE `id` = 485356 [ RunTime:0.002331s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 64 LIMIT 1 [ RunTime:0.000306s ]
  11. SELECT * FROM `article` WHERE `id` < 485356 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001424s ]
  12. SELECT * FROM `article` WHERE `id` > 485356 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001220s ]
  13. SELECT * FROM `article` WHERE `id` < 485356 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.015210s ]
  14. SELECT * FROM `article` WHERE `id` < 485356 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.017154s ]
  15. SELECT * FROM `article` WHERE `id` < 485356 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.010251s ]
0.148536s