处理textarea输入的数组(去空行and去空格)

	    //1.处理textarea输入的数组
	    if ($this->isPost()) {
	        if ($this->_post('arr')) {
	            $r = explode("\r\n", $this->_post('arr'));
	            //去掉空行元素
	            var_dump($r);
	            foreach ($r as $key => $val) {
	                if (empty($val)) {
	                    continue;
	                }
	                //去除字符串间的空格
	                $arr[] = str_replace(' ', '', $val);
	            }        
	        }
	    }

猜你喜欢

转载自blog.csdn.net/qq_33867131/article/details/79792626