THINKPHP 跨库多表联查

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

$connection = array(
        'db_type' => 'mysql',
        'db_user' => 'root',1. 
        'db_pwd'  => '123456',
        'db_host' => '127.0.0.1',
        'db_port' => '3306',
        'db_name' => 'sfc_001'
);
$model = M('goods', 'ecs_', $connection);
$res = $model
     ->table('ecshop.ecs_region t1, sfc_001.ecs_goods t2')
     ->where('t1.region_id = t2.region_id')
     ->limit(10)
     ->field('t2.*')
     ->select();

 

转载于:https://my.oschina.net/u/1422143/blog/779036

你可能感兴趣的:(THINKPHP 跨库多表联查)