1. implement the same query condition for different fields $ UserM (& quot; User & quot;); // instantiate the User object $ map [& amp; #39; name | title & amp; #39;] & amp; #39; thinkphp & amp; #39; // pass the query conditions to the queryer...
1. implement the same query conditions for different fields
- $ User = M ("User"); // instantiate the User object
- $ Map ['name | title'] = 'thinkphp ';
- // Pass the query condition into the query method
- $ User-> where ($ map)-> select ();
The query condition becomes name = 'thinkphp' OR title = 'thinkphp'
2. implement different query conditions for different fields
- $ User = M ("User"); // instantiate the User object
- $ Map ['status & title'] = array ('1', 'thinkphp', '_ multi' => true );
- // Pass the query condition into the query method
- $ User-> where ($ map)-> select ();
- '_ Multi' => true must be added at the end of the array, indicating that the current multi-condition match is performed. in this way, the query condition becomes status = 1 AND title = 'thinkphp ', more query fields are supported, for example:
- $ Map ['status & score & title'] = array ('1', array ('GT ', '0'), 'thinkphp ', '_ multi' => true );
The query condition changes to status = 1 AND score> 0 AND title = 'thinkphp'
Note:"|" And "&" cannot be used at the same time in the shortcut query method.