{"id":359,"date":"2011-12-02T00:15:52","date_gmt":"2011-12-01T16:15:52","guid":{"rendered":"http:\/\/www.youthtribe.com\/?p=359"},"modified":"2011-12-02T00:20:40","modified_gmt":"2011-12-01T16:20:40","slug":"%e6%89%b9%e9%87%8f%e4%b8%8b%e8%bd%bd%e6%96%87%e4%bb%b6%e7%9a%84%e7%a8%8b%e5%ba%8f%e6%9e%84%e6%80%9d-%e7%b1%bb%e4%bc%bc%e4%ba%8e%e6%90%9c%e7%b4%a2%e5%bc%95%e6%93%8e%e8%9c%98%e8%9b%9b","status":"publish","type":"post","link":"http:\/\/www.youthtribe.com\/archives\/359","title":{"rendered":"\u6279\u91cf\u4e0b\u8f7d\u6587\u4ef6\u7684\u7a0b\u5e8f\u6784\u601d-\u7c7b\u4f3c\u4e8e\u641c\u7d22\u5f15\u64ce\u8718\u86db"},"content":{"rendered":"

\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\u4e00\u4e2a\u5f88\u91cd\u8981\u7684\u4e1c\u897f\uff0c\u4ed6\u88ab\u5e94\u7528\u5230\u5b57\u7b26\u4e32\u7684\u89e3\u6790\uff0c\u63d0\u53d6,\u66ff\u6362\u7b49\u5404\u4e2a\u65b9\u9762\u3002
\u4eca\u5929\u53c8\u4e00\u6b21\u5b66\u4e60php\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u501f\u6b64\u673a\u4f1a\uff0c\u6765\u505a\u4e00\u4e2a\u6279\u91cf\u4e0b\u8f7djpg\u7684\u811a\u672c\u5de5\u5177\uff08\u5b9e\u9645\u4e0a\u5c31\u662f\u4e00\u4e2a\u51fd\u6570\uff09\u3002<\/p>\n

\u5148\u4ecb\u7ecd\u4e00\u4e0b\u5199\u51fa\u7684\u51fd\u6570\uff0c\u5c0f\u8bf1\u60d1\u4e00\u4e0b\uff1a
\u51fd\u6570\u6709\u4e00\u4e2a\u53c2\u6570\u5c31\u662f\u67d0\u4e2aurl\u7684\u7f51\u5740\uff0c\u7136\u540e\u51fd\u6570\u7684\u529f\u80fd\u662f\u4ece\u8be5url\u7684html\u4e2d\u5339\u914d\u51fajpg\u94fe\u63a5\uff0c\u7136\u540e\u4e0b\u8f7d\u5230\u672c\u5730\u7684pics\u6587\u4ef6\u5939\uff0c\u540c\u65f6\u904d\u5386html\u4e2d\u7684a\u6807\u8bb0\uff0c\u4ee5\u6b64\u89e3\u6790\u51fa\u76f8\u5e94\u7684href\uff0c\u518d\u8fdb\u884c\u4e0a\u6b21\u64cd\u4f5c\uff0c\u8fd9\u6837\u4e00\u4e2ajpg\u722c\u866b\uff08\u59d1\u4e14\u8fd9\u4e48\u53eb\u5427\uff09\u722c\u884c\u7684\u7b2c\u4e00\u6b65\u5c31\u505a\u597d\u4e86\u3002\u6211\u4eec\u8981\u5b9e\u73b0\u7684\u5c31\u662f\u8fd9\u4e00\u6b65\u3002\u5982\u679c\u4f60\u9009\u62e9\u7684url\u94fe\u63a5\u8f83\u591a\u6216\u8005\u56fe\u7247\u8f83\u591a\uff0c\u4f30\u8ba1\u4f1a\u8fd0\u884c\u5f88\u957f\u65f6\u95f4\u3002\u770b\u8fc7\u793e\u4ea4\u7f51\u7edc\u7684\u4eba\u5e94\u8be5\u90fd\u77e5\u9053\uff0cfacebook\u521a\u5f00\u59cb\u8d77\u6e90\u7684\u65f6\u5019\u662f\u4ece\u4e00\u4e2a\u8bc4\u5224\u7f8e\u5973\u7684\u7a0b\u5e8f\u5f00\u59cb\u7684\uff0c\u800c\u89e3\u51b3\u56fe\u7247\u6e90\u4e5f\u662f\u901a\u8fc7\u4e00\u6bb5\u4ee3\u7801\uff0c\u4e0b\u8f7d\u4e0b\u6765\u7684jpg\u56fe\u7247\u3002\u5f53\u7136\u5982\u679c\u6211\u4eec\u613f\u610f\u6211\u4eec\u53ef\u4ee5\u8ba9\u8fd9\u4e2a\u722c\u866b\u591a\u722c\u51e0\u6b21\uff0c\u8fd9\u6837\u6211\u4eec\u5c31\u53ef\u4ee5\u641e\u5230\u5f88\u591a\u5f88\u591a\u7684\u56fe\u7247\u4e86\u3002\u5e94\u8be5\u5f88\u9177\u5427\uff01<\/p>\n

<\/p>\n

\u5148\u8bf4\u8bf4\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u51e0\u4e2a\u6982\u5ff5\uff1a<\/p>\n

\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u8bed\u6cd5\u89c4\u5219\uff1aPHP\u4e2d\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u5305\u542b\u5728\u4e24\u4e2a\u5b9a\u754c\u7b26\u4e4b\u95f4\uff0c\u4e4b\u95f4\u653e\u7684\u662f\u6a21\u5f0f\u5b57\u7b26\u4e32\u4e5f\u5c31\u662f\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5173\u952e\u90e8\u5206\u3002\u5728\u4e24\u4e2a\u5b9a\u754c\u7b26\u4e4b\u540e\uff0c\u4e5f\u8bb8\u4f1a\u6709\u82e5\u5e72\u4e2a\u6a21\u5f0f\u4fee\u6b63\u7b26\uff0c\u6765\u589e\u5f3a\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u529f\u80fd\u3002\u5148\u8bf4\u5b9a\u754c\u7b26\uff0c\u9664\u4e86\u5b57\u6bcd\u6570\u5b57\u548c\u6b63\u659c\u7ebf\u4e4b\u5916\u7684\u4efb\u4f55\u5b57\u7b26\u90fd\u53ef\u4ee5\u505a\u5916\u5b9a\u754c\u7b26\u3002\u5b9a\u754c\u7b26\u5185\u90e8\u5c31\u662f\u539f\u5b50\u7684\u5929\u4e0b\u4e86\uff0c\u539f\u5b50\u7531\u90a3\u4e9b\u672a\u663e\u793a\u4e3a\u5143\u5b57\u7b26\u7684\u6253\u5370\u548c\u975e\u6253\u5370\u5b57\u7b26\u7ec4\u6210\uff0c\u5305\u62ec\u4e86\u6240\u6709\u7684\u5927\u5c0f\u5199\u5b57\u6bcd\uff0c\u6570\u5b57\uff0c\u6807\u70b9\u7b26\u53f7\u548c\u5176\u4ed6\u7b26\u53f7\u3002\u53e6\u5916\u8fd8\u5305\u542b\u4e86\u4e00\u4e9b\u975e\u6253\u5370\u5b57\u7b26\uff0c\u975e\u6253\u5370\u7b26\u53ef\u4ee5\u53bb\u67e5\u8be2\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u76f8\u5173\u6587\u6863\u3002\u4e0a\u8fb9\u63d0\u5230\u4e86\u5143\u5b57\u7b26\uff0c\u5143\u5b57\u7b26\u662f\u7528\u4e8e\u6784\u5efa\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5177\u6709\u7279\u6b8a\u542b\u4e49\u7684\u5b57\u7b26\uff0c\u4f8b\u5982\u5e38\u7528\u7684*+?\u7b49\u3002<\/p>\n

\u5143\u5b57\u7b26\u5f88\u5173\u952e\uff0c\u4ed6\u53ef\u4ee5\u8ba9\u4f60\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7b80\u5355\u51c6\u786e\u3002\u901a\u7528\u5b57\u7b26\u7c7b\u578b\u5143\u5b57\u7b26\u5c31\ufeff\u662f\u4ed6\u53ef\u4ee5\u4ee3\u66ff\u4e00\u4e9b\u5b57\u7b26\uff1a\u6bd4\u5982\u8bf4\\d\u4ee3\u8868\u6570\u5b570-9\uff0c\\D\u7528\u6765\u5339\u914d\u9664\u6570\u5b57\u4ee5\u5916\u7684\u5b57\u7b26\u3002\u8fd8\u6709\u5f88\u591a\u6709\u7528\u7684\u901a\u7528\u5b57\u7b26\u5143\u5b57\u7b26\u53ef\u4ee5\u67e5\u770b\u6587\u6863\u3002\u4e2a\u6570\u9650\u5b9a\u7b26\uff0c\u6bd4\u5982\u8bf4{n}\uff0c{n,m},{n,}\uff0c+\uff0c*\u7b49\u6bcf\u4e2a\u90fd\u7531\u6bcf\u4e2a\u7684\u542b\u4e49\u89e3\u51b3\u7684\u662f\u51fa\u73b0\u51e0\u4e2a\u524d\u8fb9\u51fa\u73b0\u7684\u5b57\u7b26\u7684\u60c5\u51b5\u3002\u8fb9\u754c\u9650\u5b9a\u7b26^,$\u5206\u522b\u7528\u6765\u5339\u914d\u5f00\u5934\u548c\u7ed3\u5c3e\u3002\u8fd8\u6709\u4e00\u4e2a\u53ef\u4ee5\u7528\u6765\u7edf\u8ba1\u5355\u8bcd\u4e2a\u6570\u7684\u5355\u8bcd\u7ed3\u5c3e\\b\u3002\u53e5\u53f7.\u88ab\u7528\u6765\u5339\u914d\u4efb\u610f\u7684\u4e00\u4e2a\u5b57\u7b26\u3002\u6a21\u5f0f\u9009\u62e9\uff0c\u6709\u65f6\u5019\u9700\u8981\u7528\u5230\u6216\u7684\u5173\u7cfb|\u7528\u6765\u5339\u914d\u4e24\u4e2a\u539f\u5b50\u4e4b\u4e2d\u7684\u4e00\u4e2a\u3002\u8fd0\u7528[]\u53ef\u4ee5\u5339\u914d\u5176\u4e2d\u7684\u4e00\u4e2a\u3002\u6a21\u5f0f\u5355\u5143()\u5c06\u4e00\u7ec4\u8868\u8fbe\u5f0f\u4f5c\u4e3a\u4e00\u4e2a\u6574\u4f53\u6765\u5f15\u7528\uff0c\u540c\u65f6\u8fd8\u53ef\u4ee5\u540e\u5411\u5f15\u7528\u3002<\/p>\n

\u6700\u540e\u5c31\u662f\u6a21\u5f0f\u4fee\u6b63\u7b26\u4e86\uff0c\u518d\u5b9a\u754c\u7b26\u7684\u540e\u8fb9\u52a0\u4e0a\u4e00\u4e9b\u5b57\u7b26\u53ef\u4ee5\u5b8c\u6210\u7279\u6b8a\u5339\u914d\uff0c\u6bd4\u5982\uff1a<\/p>\n

i\u5ffd\u7565\u5927\u5c0f\u5199\uff0cU\u8d2a\u5a6a\u6a21\u5f0f\u6700\u5927\u9650\u5ea6\u5339\u914d\u3002<\/p>\n

\u6ce8\uff1a\u672c\u6587\u53ea\u662f\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u8bfb\u8005\u8fd8\u662f\u53bb\u627e\u4e2a\u8be6\u7ec6\u7684\u5730\u65b9\u5b66\u4e60\u4e00\u4e0b\u6bd4\u8f83\u597d\u3002<\/strong><\/p>\n

\u4e0b\u9762\u6765\u5f00\u59cb\u5b9e\u73b0\u6211\u4eec\u7684\u4e1c\u897f\uff0c\u5148\u8bfb\u53d6\u4e00\u4e2aurl\u5bf9\u5e94\u7684html\uff0c\u8fd9\u4e2a\u5de5\u4f5cphp\u5df2\u7ecf\u5e2e\u6211\u4eec\u505a\u597d\u4e86\uff0cphp\u5141\u8bb8\u8bfb\u53d6\u8fdc\u7a0b\u670d\u52a1\u5668\u7684\u6587\u4ef6\uff0c\u8bfb\u53d6\u5230\u7684\u5c31\u662f\u8be5\u7f51\u9875\u7684html\uff0c\u7136\u540e\u91cd\u8981\u7684\u662f\u51e0\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u5206\u522b\u662f\u5339\u914d\u51fa\u6240\u6709\u7684a\u94fe\u63a5\uff0c\u5339\u914d\u51fa\u5176\u4e2d\u7684\u7f51\u9875\uff0c\u5339\u914d\u51fa\u9875\u9762\u4e2d\u6240\u6709\u7684jpg\u94fe\u63a5\u3002<\/p>\n

\u6b63\u5219\u8868\u8fbe\u5f0f\u5e94\u8be5\u662f\u6709\u9519\uff0c\u7136\u540e\u5c06\u5339\u914d\u7684\u7ed3\u679c\u8fdb\u884c\u4e86\u4e00\u4e0b\u5904\u7406\u3002<\/p>\n

$reg=’\/http:\\\/\\\/[^\\s\\”]*\\.jpg\/’; \/\/\u5339\u914d\u56fe\u7247url\u7684\u6b63\u5219\u8868\u8fbe\u5f0f<\/p>\n

$reg=’\/<a[^>]+>\/’; \/\/\u5339\u914da\u6807\u7b7e\u7684\u6b63\u5219\u8868\u8fbe\u5f0f<\/p>\n

$reg2=’\/http:\\\/\\\/[^\\s\\”]*\/’; \/\/\u5339\u914d\u7f51\u9875\u94fe\u63a5\u7684\u6b63\u5219\u8868\u8fbe\u5f0f<\/p>\n

\u51fd\u6570\u4ee3\u7801\u5b9e\u73b0\u5982\u4e0b\uff1a<\/p>\n

\/\/\u4e3b\u51fd\u6570\u4e3b\u8981\u8fdb\u884c\u89e3\u6790\u51fa\u5176\u4e2d\u7684a\u94fe\u63a5\u548c\u94fe\u63a5\u5730\u5740\uff0c\u5f53\u7136\u8fd8\u5305\u542b\u4e86\u4e0b\u8f7d\u5f53\u524durl\u4e2d\u7684\u6240\u6709jpg\u56fe\u7247
function jpg_spider($url) {
download_jpg($url);
<\/code><\/p>\n

\u6279\u91cf\u4e0b\u8f7d<\/p>\n

$reg=’\/<a[^>]+>\/’;
preg_match_all($reg,file_get_contents($url),$matches);
foreach($matches[0] as $v){
$reg2='\/http:\\\/\\\/[^\\s\\\"]*\/';
preg_match($reg2,$v,$m);
\/\/ echo $m[0];
if($m[0]!=''){
download_jpg($m[0]);
}
}
}<\/code><\/p>\n

\/\/\u4e0b\u8f7d\u4e00\u4e2a\u9875\u9762\u4e2d\u7684jpg\uff0c\u53c2\u6570\u662furl
function download_jpg ( $url ) {
$reg='\/http:\\\/\\\/[^\\s\\\"]*\\.jpg\/';
$str=file_get_contents($url);
preg_match_all($reg,$str,$matches);
$matches=$matches[0];
static $i=0;
foreach ($matches as $v){
\/\/ echo $v;
\/\/ echo '';
$m=file_get_contents($v);
if($m!=''){
$f='pics\/fi'.$i.'.jpg';
$i++;
file_put_contents($f,$m);
}
}
}<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"

\u6b63\u5219\u8868\u8fbe\u5f0f\u662f\u4e00\u4e2a\u5f88\u91cd\u8981\u7684\u4e1c\u897f\uff0c\u4ed6\u88ab\u5e94\u7528\u5230\u5b57\u7b26\u4e32\u7684\u89e3\u6790\uff0c\u63d0\u53d6,\u66ff\u6362\u7b49\u5404\u4e2a\u65b9\u9762\u3002 \u4eca\u5929\u53c8\u4e00\u6b21\u5b66\u4e60php\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u501f\u6b64\u673a\u4f1a\uff0c\u6765\u505a\u4e00\u4e2a\u6279\u91cf\u4e0b\u8f7djpg\u7684\u811a\u672c\u5de5\u5177\uff08\u5b9e\u9645\u4e0a\u5c31\u662f\u4e00\u4e2a\u51fd\u6570\uff09\u3002 \u5148\u4ecb\u7ecd\u4e00\u4e0b\u5199\u51fa\u7684\u51fd\u6570\uff0c\u5c0f\u8bf1\u60d1\u4e00\u4e0b\uff1a \u51fd\u6570\u6709\u4e00\u4e2a\u53c2\u6570\u5c31\u662f\u67d0\u4e2aurl\u7684\u7f51\u5740\uff0c\u7136\u540e\u51fd\u6570\u7684\u529f\u80fd\u662f\u4ece\u8be5url\u7684html\u4e2d\u5339\u914d\u51fajpg\u94fe\u63a5\uff0c\u7136\u540e\u4e0b\u8f7d\u5230\u672c\u5730\u7684pics\u6587\u4ef6\u5939\uff0c\u540c\u65f6\u904d\u5386html\u4e2d\u7684a\u6807\u8bb0\uff0c\u4ee5\u6b64\u89e3\u6790\u51fa\u76f8\u5e94\u7684href\uff0c\u518d\u8fdb\u884c\u4e0a\u6b21\u64cd\u4f5c\uff0c\u8fd9\u6837\u4e00\u4e2ajpg\u722c\u866b\uff08\u59d1\u4e14\u8fd9\u4e48\u53eb\u5427\uff09\u722c\u884c\u7684\u7b2c\u4e00\u6b65\u5c31\u505a\u597d\u4e86\u3002\u6211\u4eec\u8981\u5b9e\u73b0\u7684\u5c31\u662f\u8fd9\u4e00\u6b65\u3002\u5982\u679c\u4f60\u9009\u62e9\u7684url\u94fe\u63a5\u8f83\u591a\u6216\u8005\u56fe\u7247\u8f83\u591a\uff0c\u4f30\u8ba1\u4f1a\u8fd0\u884c\u5f88\u957f\u65f6\u95f4\u3002\u770b\u8fc7\u793e\u4ea4\u7f51\u7edc\u7684\u4eba\u5e94\u8be5\u90fd\u77e5\u9053\uff0cfacebook\u521a\u5f00\u59cb\u8d77<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,9],"tags":[49],"_links":{"self":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/359"}],"collection":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/comments?post=359"}],"version-history":[{"count":2,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/359\/revisions"}],"predecessor-version":[{"id":361,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/posts\/359\/revisions\/361"}],"wp:attachment":[{"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/media?parent=359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/categories?post=359"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.youthtribe.com\/wp-json\/wp\/v2\/tags?post=359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}