Red de conocimiento informático - Espacio del host - El archivo de código fuente abierto en el teléfono móvil está confuso.

El archivo de código fuente abierto en el teléfono móvil está confuso.

Hay muchas cuestiones involucradas en esta pregunta.

Por ejemplo, base de datos, cutStr, etc.

Pero no afecta a su inclusión en buscadores como Baidu.

Te damos un código cutStr.

Función cutStr($string, $length) {

$ strcut = ""

$ strLength = 0; (strlen($string)>$length) {

//Convierte $length a la longitud de la cadena codificada en formato UTF8 real.

for($ I = 0; $ i lt$ longitud; $i ) {

if ($strLength gt; = strlen($string))

Break;

//Cuando se detectan caracteres chinos

if(ord($ string[$ strLength]) gt; 127)

$ strLength = 3 ;

Otro

$ strLength = 1;

}

Devuelve substr($string, 0, $strLength). '...';

}else {

return $string

}

}