PHP intercepts data for more than 10 characters .... To say that the lack of change
My database has a field which has six city lengths of more than 100, if the page display, layout is not good row, so want to intercept these six fields of money 10 characters other use .... Said
Do you have any good ideas? And I'm querying the database is all the query data put in the collection
It's a little easier to write.
------Solution--------------------
You can intercept the string when you show it.
------Solution--------------------
If you are afraid of Chinese problems, use mbstring.
------Solution--------------------
discuss
You can intercept the string when you show it.
------Solution--------------------
PHP code
/** * thumbhandler * @access public *//* How to use: Automatic trimming: The program will cut the largest square from the middle according to the size of the picture, and the thumbnail $t->setsrcimg ("img/test.jpg") according to the target size; $t->setcuttype (1);//This sentence is OK $t->setdstimg ("tmp/new_test.jpg"); $t->createimg (60,60); Manual cutting: The program will take the map from the source map according to the specified location $t->setsrcimg ("img/test.jpg"); $t->setcuttype (2
------solution--------------------
Search Online, many of the
key is to consider the Zhong Wenying character Mix, a Chinese character is two bytes.
------Solution--------------------
Chinese words with this:
function Getsubstr ($s)
{
$substr =strlen ($s) >20? substr (0,20, $str). chr (0). ' ... ': $s;
return $substr;//20 = 10 Chinese
}
If Chinese and English mix, then use ASCII value to determine the number of English to take, how much to take in China
/pre>