Asf_Db_AbstractQueryBuilder::like


Description

public object like(string $columns, mixed $value)

Parameters

columns

数据库字段名称

value

模式匹配的内容

Return Values

操作成功返回 Object, 失败返回 false

Examples

Example #1 检索包含asf的内容

<?php
// string(66) "[SQL] SELECT * FROM `test1` WHERE `user` LIKE ? [BVALUES] %asf%"

use Asf\Db;

$select = Db::QBS();
$select->cols()
    ->from('test1')
    ->like('user', '%asf%');

Example #1 检索以asf开头的内容

<?php
// string(65) "[SQL] SELECT * FROM `test1` WHERE `user` LIKE ? [BVALUES] asf%"

use Asf\Db;

$select = Db::QBS();
$select->cols()
    ->from('test1')
    ->like('user', 'asf%');

Example #1 检索以asf结尾的内容

<?php
// string(65) "[SQL] SELECT * FROM `test1` WHERE `user` LIKE ? [BVALUES] %asf"

use Asf\Db;

$select = Db::QBS();
$select->cols()
    ->from('test1')
    ->like('user', '%asf');