Solve WordPress use MB

Source: Internet
Author: User
Tags knowledge base truncated

Mb_strimwidth

(PHP 4 >= 4.0.6, PHP 5)

Mb_strimwidth-gets the string truncated by the specified width

Description

String Mb_strimwidth (string $str, int $start, int $width [, String $trimmarker [, String $encoding]])

Press width to truncate the string str.

Parameters

Str

The string to truncate.

Start

The offset from the start position. The Intercept string that starts with the number of characters. (the default is 0 characters)

Width

The width of the desired trim.

Trimmarker

When a string is truncated, this string is added to the end of the truncated section.

Encoding

The encoding parameter is a character encoding. If omitted, the internal character encoding is used.

return value

A truncated string. If Trimmarker is set, the Trimmarker is also appended to the returned value.

Example

Example #1 mb_strimwidth () example

<?php

Echo mb_strimwidth ("Hello World", 0, 10, "...");

Output Hello W ...

?>

The solution WordPress uses Mb_strimwidth function to appear garbled!

1, open the Apache Server mb_string extension Service.

2. String Mb_strimwidth (string $str, int $start, int $width [, String $trimmarker [, String $encoding]]

Use the encoding parameter to set the character encoding.

Example: <?php

Echo mb_strimwidth ("ios100-Knowledge Base", 0, "...", [backcolor= Transparent] "utf-8");

?>

Reprint please indicate the source: http://www.ios100.net/open/wordpress/49.html



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.