Q &
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