gpt4 book ai didi

php - 使用php从数据库检索数据到html文件

转载 作者:行者123 更新时间:2023-11-29 08:23:34 25 4
gpt4 key购买 nike

我正在尝试制作一个评论系统,将评论保存到 MYSQL 数据库,并在提交到 HTML 表单后检索它。我很确定有一种简单的方法可以做到这一点,但我在互联网上找不到任何具体内容。

那么从 MYSQL 数据库检索某些内容到 HTML 页面的基本方法是如何的。

最佳答案

对于开始搜索 PDO教程。这是一个安静、强大的数据库访问框架。

The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP. Each database driver that implements the PDO interface can expose database-specific features as regular extension functions. Note that you cannot perform any database functions using the PDO extension by itself; you must use a database-specific PDO driver to access a database server.

PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data. PDO does not provide a database abstraction; it doesn't rewrite SQL or emulate missing features. You should use a full-blown abstraction layer if you need that facility.

PDO ships with PHP 5.1, and is available as a PECL extension for PHP 5.0; PDO requires the new OO features in the core of PHP 5, and so will not run with earlier versions of PHP.

关于php - 使用php从数据库检索数据到html文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18578829/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com