rtrim函数在此代码中不起作用

时间:2016-09-01 09:42:18

标签: javascript php jquery mysql codeigniter

当我使用带有空输入字段的其他复选框时,不需要逗号运算符[,]。 rtrim功能在这里不起作用,

我的代码

 $compydomain=$this->input->post('companydomain');//get values from                       checkboxes
   if(isset($compydomain)){
    $domains=implode(',', $compydomain);  
    if($domains == 'others'){
        $domaintext=  $this->input->post('companydomaintext');
    }else if($domains == TRUE && $this->input->post('companydomaintext')== TRUE){
        $words = explode( ",", $domains );
        array_splice( $words, -1 );
        $res= implode( " , ", $words );
        $domaintext1 = $res." , " .$this->input->post('companydomaintext'); 
        $test=substr("$domaintext1",-1);
        if($test==",")
        {
            $domaintext=rtrim($domaintext1,",") ;
        }
       else {
        $domaintext=$domaintext1;
          }
        // Concate two values
       }else{
       $domaintext=$domains;
        //$domaintext=  $this->input->post('companydomaintext');
    }



}

1 个答案:

答案 0 :(得分:0)

您想使用rtrim代替 -> xsd "yourxml.xml" (a .xsd file will be generated) -> xsd /c "yourxml.xsd" (a .cs file will be generated)   将代码更改为:

  

$ domaintext = explode(',',$ domaintext1);