I don't know if this title is correct... I saw a problem just now. he gave a group of ku6 video link addresses as follows:
I don't know if this title is correct... I saw a problem just now. he gave a group of ku6 video link addresses as follows:
Http://v.ku6.com/film/show_129194/nybK9dviY29g-kxd.html
Http://v.ku6.com/film/show_129191/YDS5hChA0bx-2Hlf.html
Http://v.ku6.com/film/show_129230/n1ogpkzI-LFQRL5_.html
Http://v.ku6.com/film/show_129182/CfhEWrBK04l0JZIf.html
Http://v.ku6.com/film/show_129199/Y-RkCmjgSKW8dE8m.html
His requirement is to get a string like nybK9dviY29g-kxd, YDS5hChA0bx-2Hlf, n1ogpkzI-LFQRL5 _, CfhEWrBK04l0JZIf, and Y-RkCmjgSKW8dE8m.
When I was thinking about how to use regular expressions, I found that the answer to the following two replies is too good.
One of the methods is to use the substr () function to traverse and Intercept:
$ Array = array ('http://v.ku6.com/film/show_129194/nybk9dviy29g-kxd.html ',
'Http://v.ku6.com/film/show_129191/yds5hcha0bx-2hlf.html ',
'Http://v.ku6.com/film/show_129230/n1ogpkzi-lfqrl5_.html ',
'Http://v.ku6.com/film/show_129182/cfhewrbk04l0jzif.html ',
'Http://v.ku6.com/film/show_129199/y-rkcmjgskw8de8m.html ');
Foreach ($ array as $ value ){
Print substr ($ value,-21,-5 )."
";
}
?>
The other is the pathinfo () function:
Mixed pathinfo (string $ path [, int $ options])
'Http://v.ku6.com/film/show_129191/yds5hcha0bx-2hlf.html ',
'Http://v.ku6.com/film/show_129230/n1ogpkzi-lfqrl5_.html ',
'Http://v.ku6.com/film/show_129182/cfhewrbk04l0jzif.html ',
'Http://v.ku6.com/film/show_129199/y-rkcmjgskw8de8m.html ');
Foreach ($ url as $ arr ){
$ Arr = pathinfo ($ arr); print_r ($ arr );
};
?>