thinkphp is object-oriented; thinkphp is a free, open source, fast, simple, object-oriented lightweight PHP development framework, which was born to simplify enterprise-level application development and agile WEB application development. Open source lightweight PHP framework.
The operating environment of this article: Windows 10 system, ThinkPHP version 6, Dell G3 computer.
Is thinkphp object-oriented?
ThinkPHP is a free, open source, fast and simple object-oriented lightweight PHP development framework for agile WEB application development and simplified enterprise applications. Developed and born.
ThinkPHP can support server environments such as windows/Unix/Linux. The official version requires PHP5.0 or above. It supports MySql, PgSQL, Sqlite databases and PDO extensions. The ThinkPHP framework itself has no special module requirements. The specific application system operating environment requirements depend on the modules involved in development.
Founded in early 2006, it was born for the development and simplification of agile WEB application development and enterprise applications. From the beginning, ThinkPHP has always followed simple and practical design principles, focusing on ease of use, while maintaining superior performance and simplicity. Code, with many original features, the team optimized ease of use, scalability and performance to improve the stability of the most advanced and powerful WEB application development framework.
Thinkphp database object-oriented
Database connection
<?php header('content-type=text/html;charset=utf-8');//设置页面html默认字符集为utf-8 $mysqli = new mysqli('127.0.0.1','用户名','密码','数据库');//创建MySQLi对象连接数据库 if ($mysqli->connect_errno) {//检测连接错误 die('连接失败'.$mysqli->connect_error);//输出错误提示符并中断脚本执行 } $mysqli->set_charset('utf8');//设置默认客户端字符集为utf8
Add data
$sql = "INSERT INTO `tableName` (`field1`,`field2`...) VALUES ('value1','value2'...)"; if ($mysqli->query($sql)) { echo '成功添加了'.$mysqli->affected_rows.'条新增记录,新增id是'.$mysqli->insert_id; } else { echo '添加失败'.$mysqli->errno.':'.$mysqli->error; }
Update data
$sql = "UPDATE `表名` SET `字段名1`='值1' WHERE '条件表达式'"; if ($mysqli->query($sql)) { echo '成功更新了'.$mysqli->affected_rows.'条记录'; } else { echo '更新失败'.$mysqli->errno.':'.$mysqli->error; }
Delete data
$sql = "DELETE FROM `表名` WHERE `id`=4"; if ($mysqli->query($sql)) { echo '成功删除了'.$mysqli->affected_rows.'条记录'; } else { echo '删除失败'.$mysqli->errno.':'.$mysqli->error; }
Query data
$sql = "SELECT `字段列表` FROM `表名` where '条件表达式'"; if ($mysqli_result=$mysqli->query($sql)) { while($row=$mysqli_result->fetch_array(MYSQL_ASSOC)){ echo '<pre class="brush:php;toolbar:false">'; print_r($row); } }
$sql = "SELECT `字段列表` FROM `表名` where '条件表达式'"; $result=$mysqli->query($sql)->fetch_array());
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of Is thinkphp object-oriented?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Atom editor mac version download
The most popular open source editor
