• thinkphp 多表关联查询 设置多条件


    $this->_link = array( 'NavigationUrl'=>array( 'mapping_type'=>HAS_MANY, 'class_name' =>'NavigationUrl', 'foreign_key'=>'cateid', 'condition'=> "uid=$a", ), 'Navicate'=>array( 'mapping_type'=>HAS_MANY, 'class_name' =>'NavigationUrl', 'foreign_key'=>'cateid', 'condition'=> "catetop=1", ), ); 其实 关联的都是一个表 但是确写了两个数组 目的是返回的数组中返回两个二维数组 分别为 ["NavigationUrl"] ["Navicate"] [1] => array(4) { ["id"] => string(1) "2" ["catename"] => string(6) "影视" ["NavigationUrl"] => array(4) { [0] => array(9) { ["url_id"] => string(1) "9" ["webname"] => string(6) "优酷" ["url"] => string(20) "http://www.youku.com" ["cateid"] => string(1) "2" ["uid"] => string(2) "23" ["time"] => string(10) "1349596263" ["hots"] => string(1) "0" ["top"] => string(1) "0" ["catetop"] => string(1) "1" } [1] => array(9) { ["url_id"] => string(2) "10" ["webname"] => string(6) "酷六" ["url"] => string(18) "http://www.ku6.com" ["cateid"] => string(1) "2" ["uid"] => string(2) "23" ["time"] => string(10) "1349596281" ["hots"] => string(1) "0" ["top"] => string(1) "0" ["catetop"] => string(1) "0" } [2] => array(9) { ["url_id"] => string(2) "12" ["webname"] => string(7) "youtube" ["url"] => string(22) "http://www.youtube.com" ["cateid"] => string(1) "2" ["uid"] => string(2) "23" ["time"] => string(10) "1349596316" ["hots"] => string(1) "0" ["top"] => string(1) "1" ["catetop"] => string(1) "0" } [3] => array(9) { ["url_id"] => string(2) "16" ["webname"] => string(9) "爱奇异" ["url"] => string(16) "http://qqiyi.vom" ["cateid"] => string(1) "2" ["uid"] => string(2) "23" ["time"] => string(10) "1349667378" ["hots"] => string(1) "0" ["top"] => string(1) "0" ["catetop"] => string(1) "0" } } ["Navicate"] => array(1) { [0] => array(9) { ["url_id"] => string(1) "9" ["webname"] => string(6) "优酷" ["url"] => string(20) "http://www.youku.com" ["cateid"] => string(1) "2" ["uid"] => string(2) "23" ["time"] => string(10) "1349596263" ["hots"] => string(1) "0" ["top"] => string(1) "0" ["catetop"] => string(1) "1" } } }
  • 相关阅读:
    P5468 [NOI2019]回家路线
    P1919 【模板】A*B Problem升级版(FFT快速傅里叶)
    P4390 [BOI2007]Mokia 摩基亚
    P4234 最小差值生成树
    P5459 [BJOI2016]回转寿司
    P2173 [ZJOI2012]网络
    P2163 [SHOI2007]园丁的烦恼
    P3826 [NOI2017]蔬菜
    P3327 [SDOI2015]约数个数和
    P1829 [国家集训队]Crash的数字表格 / JZPTAB
  • 原文地址:https://www.cnblogs.com/freefei/p/3234952.html
Copyright © 2020-2023  润新知