¡¡¡¡
½ÌÄã¼ì²é²¢Êä³öThinkphp sql²éѯÓï¾ä ²é¿´¾ßÌå´íÔÚÄÄÀï
Ê×ѡҪÕÒµ½Thinkphp\Core\Library\Think\Db\Driver.class.php ÓÃרҵ¹¤¾ß´ò¿ª
ÕÒµ½ queryº¯Êý£¬ÔÚif($fetchSql){Ç°Ãæ¼ÓÉÏÒ»ÐÐ if(isset($GLOBALS["echosql"])){ echo $this->queryStr;}¸Ä³ÉÈçÏ public function query($str,$fetchSql=false) { $this->initConnect(false); if ( !$this->_linkID ) return false; $this->queryStr = $str; if(!empty($this->bind)){ $that = $this; $this->queryStr = strtr($this->queryStr,array_map(function($val) use($that){ return '\''.$that->escapeString($val).'\''; },$this->bind)); }if(isset($GLOBALS["echosql"])){unset($GLOBALS["echosql"]); echo $this->queryStr;} if($fetchSql){ return $this->queryStr; } ¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£ ¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£ ÈçÏëÒªÊä³ösql¾ÍÔÚ¿ØÖÆÆ÷ ³ÌÐòÀïдÉÏ$GLOBALS["echosql"]=1;//¾ÍÊǶà¼ÓÕâÐÐ$user=M("user");$result = $user->where($where)->find(); exit();Äã¾Í¿ÉÒÔ¿´µ½ËûÊä³öµÄÍêÕûÌáʾµÄ£¬¶ø²»ÊÇthinkphp²»ÍêÕûµÄ´íÎóÌáʾ