I would like to ask for PHP plot. the called characters exceed the image border. How to fix line breaks? _ PHP Tutorial

Source: Internet
Author: User
I would like to ask for PHP plot. the called characters exceed the image border. How to fix line breaks ?. I would like to ask for a PHP plot. the called characters exceed the image border. How to fix line breaks? The answer is to achieve automatic line feed after a certain byte, which should be about 3 rows. How can I write a newline Q & A question?
I would like to ask for PHP plot. the called characters exceed the image border. How to fix line breaks?
Answer
We hope to achieve automatic line feed after a certain byte,

It should be around 3 rows. How can I write a line feed?

$ Content)

We hope to enable automatic line feed when the number of characters is displayed in a row

And so on in the second row! Google/Baidu hasn't found any questions about word categories for a long time

Of course the answer is hard to find. Thilai PHP

Currently used:


If (strlen ($ content)> 38 ){
$ Content1 = get_substr ($ content, 0, 38 );
$ Content2 = get_substr ($ content, 38,23 );
$ Content3 = get_substr ($ content, 37,23 );
If ($ content3! = $ Content2)
$ Content2 = $ content3;
$ Content = $ content1. "n". $ content2 ."...";
}

Function get_substr ($ string, $ start = '0', $ length = '')
{
$ Start = (int) $ start;
$ Length = (int) $ length;
$ I = 0;
If (! $ String)
{Return ;}
If ($ start> = 0 ){
While ($ I <$ start ){
If (ord ($ string [$ I])> 127 ){
$ I = $ I + 2;
} Else {
$ I ++;
}
}
$ Start = $ I;
If ($ length = ''){
Return substr ($ string, $ start );
}
Elseif ($ length> 0 ){
$ End = $ start + $ length;
While ($ I <$ end ){
If (ord ($ string [$ I])> 127 ){
$ I = $ I + 2;
} Else {
$ I ++;
}
} If ($ end! =$ I-1 ){
$ End = $ I;
} Else {
$ End --;
}
$ Length = $ end-$ start;
Return substr ($ string, $ start, $ length );
} Elseif ($ length = 0 ){
Return;
} Else {
$ Length = strlen ($ string)-abs ($ length)-$ start;
Return get_substr ($ string, $ start, $ length );
}
} Else {
$ Start = strlen ($ string)-abs ($ start );
Return get_substr ($ string, $ start, $ length );
}
}

This is not flexible. Hope that experts can provide a more convenient way! Thank you!



For example, I want:

Signature: + $ content + time

Details:

Signature: If you are not sure
And you will lose the opportunity. Skyfly
It's a Cainiao, and birds are running on the ground.
DISH .!
7: 59

How can I achieve this effect?

It seems to be divided into three tags.

Label 1: custom text
Label 2: Details
Tag 3: release date

They can be neatly displayed in a fixed block.

Like QQ's example: [img] http://p.taotao.com/images/head/79/45/00/16/79450016_2.png#/img]

It is like this effect. In fact, I also want to do this kind of thing! This is the content!



The final goal is to achieve the effect of doing the graph with the promise? [Img] quit

[]

Let me answer





Could you tell me the PHP plot, the called character exceeds the image border. How to fix line breaks? The answer is to achieve automatic line feed after a certain byte, which should be about 3 rows. How can I write a line feed...

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.