[php]Onethink used 8421 code in checkbox

2019-3-16 写技术

Onethink used 8421 code in checkbox, and if it is extra values must add processing function in logic model.

Like that:

Application\Admin\Logic\ProductLogic.class.php

 

 protected $_auto = array(
  array('duoxuan', 'getDuoxuan', self::MODEL_BOTH, 'callback'),
 );

 

 

    protected function getDuoxuan(){
        $duoxuan = I('post.duoxuan');
        if(!is_array($duoxuan)){
            return 0;
        }else{
            $pos = 0;
            foreach ($duoxuan as $key=>$value){
                $pos += $value;		//将各个推荐位的值相加
            }
            return $pos;
        }
    }	
 

 

标签: php

发表评论:

Powered by anycle 湘ICP备15001973号