中文截取 modifier.cn_truncate.php
引用:';
1
1'; $ubbs['td2'][0] = '/[td([^(]|[)]+)](.*?)[/td]/s'; $ubbs['td2'][1] = ' | 2'; $str = str_replace('[*]',' foreach ($ubbs as $ubb){ $str = ubb_replace($ubb[0],$ubb[1],$str); } return $str; } function ubb_replace($pattern,$replacement,$str){ do { $str_ret = $str; $str = preg_replace($pattern,$replacement,$str); }while($$str); return $str_ret; } ?> 编码 modifier.unescape.php
复制代码 代码如下:
function smarty_modifier_unescape($str) { $str = rawurldecode($str); preg_match_all("/(?:%u.{4})|[^%]+/",$str,$r); $ar = $r[0]; foreach($ar as $k=>$v) { if(substr($v,0,2) == "%u" && strlen($v) == 6) $ar[$k] = iconv("UCS-2","GB2312",@pack("H4",substr($v,-4))); } return join("",$ar); }
Previous article:PHP quoting is a bad habit_PHP Tutorial
Next article:Implementation code for generating Flash animation with PHP_PHP tutorial
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Latest Issues
Group MySQL results by ID for looping over
I have a table with flight data in mysql. I'm writing a php code that will group and displ...
From 2024-04-06 17:27:56
0
1
406
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
|