一、远程服务器的防火墙要开启3306端口;
二、远程数据库的用户host要设为%,不能设为localhost
$test = M('tablename','hd_','mysql://root:111111@192.168.1.100:3306/dbname#utf8'); $count= $test->count();