get_headers是獲取http頭信息,get_meta_tags是獲取網(wǎng)頁的description,abstract,keywords等信息.
- */
- $url='http://www.companysz.com'; //定義url
- print_r(get_headers($url)); //無格式獲取
- print_r(get_headers($url,1)); //帶上格式獲取
- /*
- array
- (
- [0] => http/1.1 200 ok
- [1] => connection: close
- [2] => date: sat, 11 dec 2010 05:43:46 gmt
- [3] => content-length: 69617
- [4] => content-type: text/html
- [5] => content-location: http://www.companysz.com/index.html
- [6] => last-modified: sat, 11 dec 2010 05:19:51 gmt
- [7] => accept-ranges: bytes
- [8] => etag: "e8be4b9f398cb1:6c66"
- [9] => server: microsoft-iis/6.0
- [10] => x-powered-by: asp.net
- )
- array
- (
- [0] => http/1.1 200 ok
- [connection] => close
- [date] => sat, 11 dec 2010 05:43:47 gmt
- [content-length] => 69617
- [content-type] => text/html
- [content-location] => http://www.companysz.com/index.html
- [last-modified] => sat, 11 dec 2010 05:19:51 gmt
- [accept-ranges] => bytes
- [etag] => "e8be4b9f398cb1:6c66"
- [server] => microsoft-iis/6.0
- [x-powered-by] => asp.net
- )
- get_meta_tags($url);
- 獲取指定網(wǎng)頁的description,abstract,keywords等信息
- */
- $tags=get_meta_tags('http://www.companysz.com/'); //提取meta標(biāo)簽
- print_r($tags) //輸出數(shù)組全部內(nèi)容
- /*
- array
- (
- [description] => 網(wǎng)頁制作教程網(wǎng)提供專業(yè)網(wǎng)頁設(shè)計(jì)教程與網(wǎng)頁制作教程包括有photoshop教程,flash,html,css教程,dreamweaver,fireworks,asp,php教程,jsp教程,asp.net,網(wǎng)站建設(shè),網(wǎng)站開發(fā),網(wǎng)頁特效,平面設(shè)計(jì),個(gè)人網(wǎng)站,網(wǎng)頁素材
- [abstract] => 提供最新的網(wǎng)頁制作教程、網(wǎng)頁設(shè)計(jì)教程、網(wǎng)頁特效,為個(gè)人網(wǎng)站提供網(wǎng)頁素材模板和網(wǎng)頁視頻學(xué)習(xí)。
- [keywords] => 網(wǎng)頁設(shè)計(jì)教程,網(wǎng)頁制作教程,網(wǎng)頁學(xué)習(xí),photoshop,flash,html,css,dreamweaver,fireworks,asp,php,jsp,asp.net,網(wǎng)頁特效,平面設(shè)計(jì),網(wǎng)頁素材
- )
注意:使用該函數(shù)需要把 php.ini里面的allow_url_fopen = on,才能使用.
新聞熱點(diǎn)
疑難解答