PHP头条
热点:

PHP用switchreturn返回值有关问题


PHP 用switch return 返回值问题
 public function banben(){

        $this->load->library('LibUser');   
       
        $cc ;
        switch ($this->libuser->getUserType()){
              case 1:
              $cc = $this->libuser->version("a");
              break; 
              case 2:  
              $cc = $this->libuser->version("b");
              case 6:  
              $cc = $this->libuser->version("c");
              break;
              default:
              $cc = "没有数据";
              break;
        }
        return $cc;
    }
----------------------------------------------------
前提我不想用ifelse ,用switch 能不能 return 回去呢?大虾 出来 switch php library 分享到:
------解决方案--------------------
当然可以啊,你都写好了,测试下不就知道了吗?

www.phpzy.comtrue/phprm/1588.htmlTechArticlePHP用switchreturn返回值有关问题 PHP 用switch return 返回值问题 publicfunctionbanben(){ $this->load->library('LibUser'); $cc; switch($this->libuser->getUserType()){ case1: $cc=$this->libuser->version("a"); break; case2: $cc=$th...

相关文章

相关频道:

PHP之友评论

今天推荐