Sure, here's the code to display the data using ThinkPHP:

Controller:

namespace app\controller;

use think\Controller;
use app\model\User;

class UserController extends Controller
{
    public function index()
    {
        $userModel = new User();
        $users = $userModel->select();
        
        $this->assign('users', $users);
        
        return $this->fetch('index');
    }
}

View (index.html):

<!DOCTYPE html>
<html>
<head>
    <title>User List</title>
</head>
<body>
    <h1>User List</h1>
    <table>
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Email</th>
        </tr>
        {volist name="users" id="user"}
            <tr>
                <td>{$user.id}</td>
                <td>{$user.name}</td>
                <td>{$user.email}</td>
            </tr>
        {/volist}
    </table>
</body>
</html>

Make sure to replace the app\controller\UserController and app\model\User namespaces with your actual controller and model namespaces. Also, adjust the database table and field names according to your database structure.

This code assumes that you have a User model and a corresponding database table with id, name, and email fields

你刚刚给我的代码换一种Thinkphp显示

原文地址: https://www.cveoy.top/t/topic/imBo 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录