|
PHP复制代码
else //如果文章上传成功
{
$this->load->helper('file');
$this->load->model('article_model');
$upload_data = $this->upload->data();
$text = read_file ($upload_data['full_path']);
$text = nl2br($text);
//将$text转换成数组
$paras = explode('<br />', $text);
$paras = array_filter($paras,'blankFilter');
复制代码
blankFilter定义在helpers里面,内容如下
PHP复制代码
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
if ( ! function_exists('blankFilter'))
{
function blankFilter ($value)
{
if($value == '' || $value == '\n\r' || $value == '\n' || $value == '\r' || $value == '<br />' || $value == null){
return FALSE;
}
else
{
return TRUE;
}
}
}
复制代码
|
|