Home > Backend Development > PHP Tutorial > PHP randomly extracts titles from content_PHP tutorial

PHP randomly extracts titles from content_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:52:42
Original
1360 people have browsed it

$temp=$LabelArray['content'];

$temp=preg_replace("%<[^>]+>%",',',$temp);//Prevent letters in the URL from being matched

$temp=make_semiangle($temp);//Half-width conversion

if(preg_match_all("%[[:punct:]]([^[:punct:]]{5,30})[[:punct:]]%u",$temp,$arr)){

$i=rand(0,count($arr[0])-1);

$LabelArray['Title']=$arr[1][$i];

}

//Full-width and half-width rotation

function make_semiangle($str)

{

$arr = array('0' => '0', '1' => '1', '2' => '2', '3' => '3', '4 ' => '4',

> 9',

> E',

> J',

> O',

                    'P' => 'P', 'Q' => 'Q', 'R' => T',

                   'U' => 'U', 'V' => Y',

> d',

> i',

'n' n',

> s',

> x',

'y' => 'y', 'z' => 'z',

> [',

                  ']' => ']', '〖' => ]',

                 '‘' => '[', '’' => ']', '{' => '{', '}' => '}', '《' => '<', 

                 '》' => '>', 

                 '%' => '%', '+' => '+', '—' => '-', '-' => '-', '~' => '-', 

                 ':' => ':', '。' => '.', '、' => ',', ',' => '.', '、' => '.', 

                 ';' => ',', '?' => '?', '!' => '!', '…' => '-', '‖' => '|', 

                 '”' => '"', '’' => '`', '‘' => '`', '|' => '|', '〃' => '"', 

                 ' ' => ' ','$'=>'$','@'=>'@','#'=>'#','^'=>'^','&'=>'&','*'=>'*',

                 '"'=>'"');

     return strtr($str, $arr); 

}

echo serialize($LabelArray);

?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/478087.htmlTechArticle?php $temp=$LabelArray[内容]; $temp=preg_replace(%[^]+%,,,$temp);//防止网址中字母被匹配 $temp=make_semiangle($temp);//半角转化 if(preg_match_all(%[[:punct:]]([^[:pu...
source:php.cn
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 Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template