thinkphp article management code_PHP tutorial

WBOY
Release: 2016-07-13 17:53:22
Original
1002 people have browsed it

自己封装的方法:
    function wenzhang1($chart=''){
      $user=D($chart);
     
       $list=$user->where("products_category=1")->select();
           //thumbRemoveOrigin
      
           $this->assign("wenzhang1",$list);
      
       }
    function wenzhang2($chart=''){
      $user=D($chart);
     
       $list=$user->where("products_category=2")->select();
           //thumbRemoveOrigin
      
           $this->assign("wenzhang2",$list);
      
       }
    function wenzhang3($chart=''){
      $user=D($chart);
     
       $list=$user->where("products_category=3")->select();
           //thumbRemoveOrigin
      
           $this->assign("wenzhang3",$list);
      
       }
    function wenzhang4($chart=''){
      $user=D($chart);
     
       $list=$user->where("products_category=4")->select();
           //thumbRemoveOrigin
      
           $this->assign("wenzhang4",$list);
      
       }
    function wenzhang5($chart=''){
      $user=D($chart);
     
       $list=$user->where("products_category=5")->select();
           //thumbRemoveOrigin
      
           $this->assign("wenzhang5",$list);
      
       }
    function wenzhangxi($chart='',$pid=''){
      $user=D($chart);
     
       $list=$user->where("products_id=".$pid."")->select();
           //thumbRemoveOrigin
      
           $this->assign("wenzhangxi",$list);
      
       }
    function wenzhangx(){
       $this->wenzhang1('wenzhang');
       $this->wenzhang2('wenzhang');
       $this->wenzhang3('wenzhang');
       $this->wenzhang4('wenzhang');
       $this->wenzhang5('wenzhang');
   
   
    }

后台代码:
在后台代码中加入这句话(调用封装好的方法,上面有)
$this->wenzhangx();

前台显示代码:


 

       

支付方式


         
        

{$vo.products_name}


         

       
      

 

 


       

配送方式


      
        

{$vo.products_name}


         
www.2cto.com
 

 


 


作者:nycqwert

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/478031.htmlTechArticle自己封装的方法: function wenzhang1($chart=){ $user=D($chart); $list=$user-where(products_category=1)-select(); //thumbRemoveOrigin $this-assign(wenzhang1,$list); } functio...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template