hyperf print mysql native statement

1. Use the tosql() method

$sql = Db::table("user")->where(["id"=>1])->toSql();
echo $sql;

Insert picture description here
2. Use hyperf's monitoring event to print out the most recent executed statement
Insert picture description here
3. Go directly to the hyperf log to find

$sql = Db::table("user")->where(["id"=>1])->get();

Insert picture description here

After summarizing, I personally recommend tosql, which is the easiest.

Guess you like

Origin blog.csdn.net/weixin_42094764/article/details/115002641