phalapi框架where条件查询

// WHERE name = 'dogstar' AND age = 18
$user->where(array('name' => 'dogstar', 'age' => 18))

// WHERE name = 'dogstar' OR age = 18
$user->or('name', 'dogstar')->or('age', 18)

// WHERE ((name = ? OR id = ?)) AND (note = ?) -- 'dogstar', '1', 'xxx'
#实现方式1:使用and拼接 $user->where('(name = ? OR id = ?)', 'dogstar', '1')->and('note = ?', 'xxx')
#实现方式2:只使用where,不用数组传参 $user->where('(name = ? OR id = ?) AND note = ?', 'dogstar', '1', 'xxx')
#实现方式3:只使用where,用下标为顺序数字的数组传参 $user->where('(name = ? OR id = ?) AND note = ?', array('dogstar', '1', 'xxx'))
#实现方式4:只使用where,用下标为标识符的数组传参 $user->where('(name = :name OR id = :id) AND note = :note', array(':name' => 'dogstar', ':id' => '1', ':note' => 'xxx'))

转载于:https://www.cnblogs.com/pcx105/p/6887895.html

你可能感兴趣的:(phalapi框架where条件查询)