• 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" } } }
  • 相关阅读:
    c++流迭代器
    SQL Server中的临时表和表变量
    基于组件的.NET软件开发
    COM组件转换成.NET组件
    将.net组件注册为com组件
    命令提示符窗口中的快捷键
    Log4net: use Sql Server to log your application events
    Retrieving the COM class factory for component with CLSID {0002450000000000C000000000000046} failed due to the following error: 80070005.
    Office Primary Interop Assemblies
    Adding custom code to Local Reports in Visual Studio.NET 2005 (Problems & Solutions)
  • 原文地址:https://www.cnblogs.com/freefei/p/3234952.html
Copyright © 2020-2023  润新知