Php Codeigniter中的字限制器,如何在限制后回显字?
我正在文本助手中使用codeigniter word_limiter()函数Php Codeigniter中的字限制器,如何在限制后回显字?,php,codeigniter,Php,Codeigniter,我正在文本助手中使用codeigniter word_limiter()函数 $string = "Here is a nice text string consisting of eleven words."; $string = word_limiter($string, 4); // Returns: Here is a nice… 上述函数将输出限制为四个字。如何将限制后的单词也存储在变量中以供使用?尝试以下方法: $original_string = "Here is a nic
$string = "Here is a nice text string consisting of eleven words.";
$string = word_limiter($string, 4);
// Returns: Here is a nice…
上述函数将输出限制为四个字。如何将限制后的单词也存储在变量中以供使用?尝试以下方法:
$original_string = "Here is a nice text string consisting of eleven words.";
$limited_string = word_limiter($original_string , 4, '');
$rest_of_string = trim(str_replace($limited_string, "", $original_string));
试试这个:
$original_string = "Here is a nice text string consisting of eleven words.";
$limited_string = word_limiter($original_string , 4, '');
$rest_of_string = trim(str_replace($limited_string, "", $original_string));