Home >Backend Development >PHP Problem >What does php's ORM mean?
In PHP, the full name of ORM is "Object-Relational Mapping", which means "object-relational mapping". Simply put, it is a mapping between the object model and the relational model; the main purpose of ORM is to convert the object model into The represented objects are mapped to the SQL-based relational model database structure.
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
What does orm mean?
O = Object
select * from post where id = 1and then output the title and content using
echo $post['title']; echo $post['content'];The above code encounter People with object-oriented obsessive-compulsive disorder will struggle to death. So they came up with this thing, getting an article in ORM can be like this:
$post = postTable::getInstance()->find(1);#会再内部执行select * from post where id = 1Then output:
echo $post->getTitle(); echo $post->getContent();Mom no longer has to worry about my obsessive-compulsive disorder ^_^Advanced application, articles and categories are one-to-many relationships, articles and tags are many-to-many relationships
$cate = $post->getCategory(); //获取文章分类 echo $cate->getName(); //获取分类名 $tags = $post->getTags(); //获取一个文章的所有标签Is it possible to get us without writing a single sql? All the data needed? Using ORM, you can implement applications without writing SQL at all. ORM does all this for us.
In addition, ORM can also isolate the underlying database layer. We don't need to care whether we are using mysql or other relational databases.
PHP Video Tutorial"
The above is the detailed content of What does php's ORM mean?. For more information, please follow other related articles on the PHP Chinese website!