Ask PHP to draw, call the character beyond the picture border. How do I fix a line break? _php Tutorials

Source: Internet
Author: User
Question
Ask PHP to draw, call the character beyond the picture border. How do I fix a line break?
Answer
Want to be able to reach a certain byte after the automatic line-wrapping,

Should be around 3 rows. How do I write a newline?

$content (content)

Want to be able to achieve a row to show how many characters are automatically wrapped

The second row is also followed by analogy! Google/Baidu for half a day did not find the question of speech

Of course, the answer is difficult to find. Special to PHP questions

Now used:


if (strlen ($content) >38) {
$content 1=get_substr ($content, 0,38);
$content 2=get_substr ($content, 38,23);
$content 3=get_substr ($content, 37,23);
if ($content 3!= $content 2)
$content 2= $content 3;
$content = $content 1. " N ". $content 2." ...";
}

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);
}
}

It's a very inflexible way to do it. Hope that the master can provide a more convenient way! Thank you!



For example, I want to achieve:

Signature: + $content + Time

Specific situation:

Signature: If you hesitate again
, I lost my chance. Sky Fly
A rookie, a bird on the ground
Dish.! 2009-04-07 on 10:3
7:59

I hope this effect is how to achieve it?

It feels like it's divided into three tabs.

Label One: Custom text
Tag two: specific content
Tag three: Release time

Combine to make them appear neatly in a fixed block

Just like the surging of QQ: [IMG]HTTP://P.TAOTAO.COM/IMAGES/HEAD/79/45/00/16/79450016_2.PNG[/IMG]

Just like this effect. Actually I want to do this kind of thing too! Is the content of this piece encountered a problem!



The ultimate goal is to achieve this kind of chart effect? [img]http://www.111cn.cn/bbs/images/smilies/default/loveliness.gif[/img][img]http://www.111cn.cn/bbs/images/ SMILIES/DEFAULT/LOVELINESS.GIF[/IMG]

[ ]

I'll answer that.





http://www.bkjia.com/PHPjc/632504.html www.bkjia.com true http://www.bkjia.com/PHPjc/632504.html techarticle Ask the PHP graphing, calling the characters beyond the picture border. How do I fix a line break? The answer wants to be able to reach a certain byte after the automatic line, should be around 3 rows. How do I write a line break ...

  • 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.