Home > Article > PHP Framework > Is thinkphp object-oriented?
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.
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.
<?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
$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; }
$sql = "UPDATE `表名` SET `字段名1`='值1' WHERE '条件表达式'"; if ($mysqli->query($sql)) { echo '成功更新了'.$mysqli->affected_rows.'条记录'; } else { echo '更新失败'.$mysqli->errno.':'.$mysqli->error; }
$sql = "DELETE FROM `表名` WHERE `id`=4"; if ($mysqli->query($sql)) { echo '成功删除了'.$mysqli->affected_rows.'条记录'; } else { echo '删除失败'.$mysqli->errno.':'.$mysqli->error; }
$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!