php页面中
已知三个参数: 主页url,主页中所含的所有子页url,url规格
要求:从所有的子页中按url规格去输出相应的url比如 已知
主页url: http://www.e-jjj.com/design/index.html
所有的子页有: http://www.e-jjj.com/Product/HTML/0091/91850.html,
http://www.e-jjj.com/Product/HTML/0091/91862.html,
http://www.e-jjj.com/Case/Solution.aspx....
url规格: http://www.e-jjj.com/Article/HTML/(*)/(*).html
要求输出: http://www.e-jjj.com/Product/HTML/0091/91850.html,
http://www.e-jjj.com/Product/HTML/0091/91862.html,这个方法怎么写呀,THANKS
已知三个参数: 主页url,主页中所含的所有子页url,url规格
要求:从所有的子页中按url规格去输出相应的url比如 已知
主页url: http://www.e-jjj.com/design/index.html
所有的子页有: http://www.e-jjj.com/Product/HTML/0091/91850.html,
http://www.e-jjj.com/Product/HTML/0091/91862.html,
http://www.e-jjj.com/Case/Solution.aspx....
url规格: http://www.e-jjj.com/Article/HTML/(*)/(*).html
要求输出: http://www.e-jjj.com/Product/HTML/0091/91850.html,
http://www.e-jjj.com/Product/HTML/0091/91862.html,这个方法怎么写呀,THANKS
$string = <<<CONT
主页url: http://www.e-jjj.com/design/index.html
所有的子页有: http://www.e-jjj.com/Product/HTML/0091/91850.html,
http://www.e-jjj.com/Product/HTML/0091/91862.html,
http://www.e-jjj.com/Case/Solution.aspx....
CONT;
preg_match_all('/http:\/\/www\.e-jjj\.com\/Product\/HTML\/\d+\/\d+\.html/is', $string, $matches);
print_r($matches);
?>
url规格是一参数,要写个通用的匹配方法出来,
在这:
http://www.w3school.com.cn/php/func_mail_mail.asp但是。你要配置好你的服务器。我估计你的邮件服务器还没配置好。似乎不仅仅是ini文件需要配置。
参考:http://www.google.com.hk/search?hl=zh-CN&newwindow=1&safe=strict&q=php+linux+%E9%85%8D%E7%BD%AE%E9%82%AE%E4%BB%B6%E6%9C%8D%E5%8A%A1%E5%99%A8&aq=f&aqi=&aql=&oq=&gs_rfai=
$s = <<< TEXT
主页url: http://www.e-jjj.com/design/index.html
所有的子页有: http://www.e-jjj.com/Product/HTML/0091/91850.html,
http://www.e-jjj.com/Product/HTML/0091/91862.html,
http://www.e-jjj.com/Case/Solution.aspx....
TEXT;$ar = foo($s, "http://www.e-jjj.com/(*)/HTML/(*)/(*).html");
print_r($ar);function foo($text, $pattern) {
$pattern = str_replace('\(\*\)', '.*', preg_quote($pattern));
if(preg_match_all("#$pattern#", $text, $reg))
return $reg[0];
return false;
}