Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Codeigniter中的字限制器,如何在限制后回显字?_Php_Codeigniter - Fatal编程技术网

Php Codeigniter中的字限制器,如何在限制后回显字?

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

我正在文本助手中使用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 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));