当前位置:Gxlcms > PHP教程 > [discuzX2.5]Itisnotsafetodothisquery查询不允许有引号解决办法

[discuzX2.5]Itisnotsafetodothisquery查询不允许有引号解决办法

时间:2021-07-01 10:21:17 帮助过:3人阅读

[discuz X2.5]It is not safe to do this query查询不允许有引号
各位给discuzX2.5做二次开发的,请问你在自已表里糊糊查询或者要查一个字符串username的时候,怎么处理的???

目前我用:DB::query('select * from t_username where f_username="'.$username.'"');

我发现只要sql里含有引号就会出错。问下大家自个查询自己的表,怎么写sql语句呀。

------解决方案--------------------
' "调换一下呢
------解决方案--------------------
DB::query("select * from t_username where f_username='$username'");

人气教程排行