简体   繁体   中英

Why, request return symbol — '?'

Why any value in a variable $search return a character — ? ?

$search = 'words'
Post::where("description", 'like', "%".$search."%")->toSql();

Result:

"select * from `post` where `description` like ?"

The method toSql() does not include bindings, and therefore you're seeing the question mark in their place. To see the bindings, you can use getBindings() like so:

$search = 'words';
Post::where("description", 'like', "%".$search."%")->getBindings();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM