thinkphp 文字 羅選 欄位 都在一個表裡面

來源:互聯網
上載者:User
thinkphp 文字 篩選 欄位 都在一個表裡面




程式碼

public function index(){
$Data = M('zhaopin'); // 執行個體化Data資料對象
import('ORG.Util.Page');// 匯入分頁類
$count= $Data->where($map)->count();// 查詢滿足要求的總記錄數
$Page= new Page($count,20);// 執行個體化分頁類 傳入總記錄數
$nowPage = isset($_GET['p'])?$_GET['p']:1;
$list = $Data->where($map)->order('shijian desc,id asc')->page($nowPage.','.$Page->listRows)->select();
$show = $Page->show();// 分頁顯示輸出
$this->assign('count',$count);
$this->assign('page',$show);// 賦值分頁輸出
$this->assign('list',$list);// 賦值資料集
$this->display(); // 輸出模板
}


篩選的地方

招聘職位:

全部

{$vo['Position']}

地區:

全深圳

{$vo['Recruitment']}



內容代碼


{$vo['Job']|mb_substr=0,8,'UTF-8'}
{$vo['company_name']}
{$vo['Recruitment']}
{$vo['shijian']}
招聘人數:{$vo['hiring']}人
公司性質:{$vo['Nature']}
規模:{$vo['company_scale']}人
經驗:{$vo['Work_experience']}年
學曆:{$vo['Degree_required']}
職位月薪:{$vo['salary']}元/月
崗位要求: {$vo['Job_requirements']|mb_substr=0,150,'UTF-8'}
查看職位


------解決思路----------------------

public function index(){
$Data = M('zhaopin'); // 執行個體化Data資料對象
import('ORG.Util.Page');// 匯入分頁類

$map="1=1 ";//初始化條件變數
$Position=$this->_param('Position');//接收參數
$Recruitment=$this->_param('Recruitment');//接收參數
if($Position<>''){
$map.=" and Position='$Position'";
}
if($Recruitment<>''){
$map.=" and Recruitment='$Recruitment'";
}

$count= $Data->where($map)->count();// 查詢滿足要求的總記錄數
$Page= new Page($count,20);// 執行個體化分頁類 傳入總記錄數
$nowPage = isset($_GET['p'])?$_GET['p']:1;
$list = $Data->where($map)->order('shijian desc,id asc')->page($nowPage.','.$Page->listRows)->select();
$show = $Page->show();// 分頁顯示輸出
$this->assign('count',$count);
$this->assign('page',$show);// 賦值分頁輸出
$this->assign('list',$list);// 賦值資料集
$this->display(); // 輸出模板
}

大概是這個樣子,樓主看看是否有用
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.