search

Home  >  Q&A  >  body text

thinkphp M database cannot be switched

In version 3.1 of tp, a database needs to be temporarily switched in the code
$a=M('admin_user')->select();
$b=M_O("compony")->sele ct();
$c=M('xx','cc_','mysql://root:root@111.111.111.111/db')->select;
M_O method is return One is similar to M('xx','cc_','mysql://root:root@111.111.111.111/db'), but $c returns false. It seems that the connection is not sent and is switched to the local one. Is this the case? What's going on

ringa_leeringa_lee2813 days ago410

reply all(1)I'll reply

  • 滿天的星座

    滿天的星座2017-05-16 13:00:13

    Look at the log, are you not connected to the database?

    reply
    0
  • Cancelreply