The main purpose of distinct() in TP is to remove duplicate values. Below I will introduce to you the usage of distinct() in Thinkphp through example code. Let’s take a look.
The main purpose of distinct() in TP is It is to remove duplicate values
It is also explained in detail in the Thinkphp manual (link: http://document.thinkphp.cn/manual_3_2.html#distinct)
The following is my personal example :
##The display is like this If you add distinct:The displayed result is The following is the posted code
$offernum = M('offer')->distinct(true)->where('order_id='.$order_id)->field('user_id,number')->select(); dump($offernum);
Usage of session() method in thinkPHP
Constructor _construct( of class in ThinkPHP ) and _initialize()
The above is the detailed content of Usage of distinct in Thinkphp. For more information, please follow other related articles on the PHP Chinese website!