search

Home  >  Q&A  >  body text

Verify whether the user has registered in thinkphp

How does thinkphp determine whether the username already exists in the database

MerovingianMerovingian2356 days ago1077

reply all(1)I'll reply

  • 新鲜的**鸡腿

    新鲜的**鸡腿2018-08-08 21:25:07

    $db_username = Db::name('用户表')->where('username','=','用户名')->find();

    if($db_username != 0){

        echo 'Username already exists';

    }

    reply
    1
  • Cancelreply