The external link code function in the php regular string. Php Tutorial regular string external link code function functioneemptyarray ($ val) {$ links; if (is_array ($ val) {foreach ($ valas $ v $ _ v) {if (! Empty ($ _ v [0]) {$ php Tutorial external link code functions in regular strings
Function deleteemptyarray ($ val)
{
$ Links = '';
If (is_array ($ val ))
{
Foreach ($ val as $ v =>$ _ v)
{
If (! Empty ($ _ v [0])
{
$ Links. = $ _ v [0]. '| ';
}
}
Return substr ($ links, 0,-1 );
}
Else
{
Return false;
}
}
Function getoutlink ($ body)
{
$ Tempcontent = $ body;
Preg_match_all ("// I", $ tempcontent, $ tempurl );
$ Urls = array ();
Foreach ($ tempurl [0] as $ value)
{
If (strstr ($ value, 'http '))
{
If (stristr ($ value, $ localurl ))
{
Continue;
}
Else
{
Preg_match_all ("/hrefs * = s * (['"]?) (.*?) 1/is ", $ value, $ vlink );
$ Urls [] = $ vlink [2];
}
}
}
// Print_r ($ urls );
$ Strurl = explode ('|', deleteemptyarray ($ urls ));
$ Tempcount = array_unique ($ strurl );
Echo 'external chain'. count ($ tempcount)-1;
}
// Call method
$ Body = "aaahttp: // www.bkjia.com> I am an external connection ";
Echo getoutlink ($ body );
Function deleteemptyarray ($ val) {$ links = ''; if (is_array ($ val )) {foreach ($ val as $ v =$ _ v) {if (! Empty ($ _ v [0]) {$...