Index.php 989 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace app\index\controller;
  3. use app\index\model\CommonModel;
  4. use app\index\model\ColumnModel;
  5. use app\index\controller\Base;
  6. class Index extends Base
  7. {
  8. public function index()//主页
  9. {
  10. $cum = new ColumnModel();//导航栏表
  11. $com = new CommonModel();//工具信息表
  12. // $cums = $cum->select();
  13. $column_id=input('column_id');
  14. //查询当前导航栏表名称
  15. $cid=$cum->find($column_id);
  16. //查询当前工具信息表下的信息
  17. $goods=$com->where(array('column_id'=>$column_id))->order('sort desc')->select();
  18. $this->assign([
  19. 'goods'=>$goods,
  20. 'cid'=>$cid,
  21. ]);
  22. return view();
  23. }
  24. public function title(){
  25. $id = input('id');
  26. $titles = db('good')->where('id',$id)->find();
  27. $this->assign([
  28. 'titles'=>$titles,
  29. ]);
  30. return view($titles['url']);
  31. }
  32. }