Php get_meta_tags Function

Source: Internet
Author: User

Php get_meta_tags Function

Get_meta_tags
(PHP 4 and PHP 5)

Get_meta_tags-extract all relay TAG content attributes from a file and return an array

Description
Array get_meta_tags (string $ file name [, Boolean $ use_include_path = false])
Open the file and parse its line

Marked file. Analysis site "/Header ".

Parameters

File Name
As a string. This can be a local file or URL.


For example, #1 get_meta_tags () Parsing





"/Header" "! -Resolution stops here-"(note the end of the line-the usage function of PHP parses local investment, so the Mac file will not work in Unix ).

Use_include_path
Setting use_include_path to TRUE causes PHP to attempt to open the file by following the include_path command along the road. This is used for local files, not URLs.


Return Value
Returns all resolved meta tags of an array.

The Value Name attribute becomes the value of the property of the key value content, which is returned to the array, so that you can easily use standard array functions to traverse or access a single value. The value property name of a special character replaces '_', and the rest will be converted to lower case. If two relay tags have the same name, only the last one is returned.

Modify

Version description
The HTML attribute unquoted supported by 4.0.5 is added.


Instance

For example, #2 What get_meta_tags () returns

// Assuming the above tags are at www.example.com
$ Tags = get_meta_tags ('HTTP: // www.example.com /');

// Notice how the keys are all lowercase now, and
// How. was replaced by _ in the key.
Echo $ tags ['author']; // name
Echo $ tags ['keyword']; // php documentation
Echo $ tags ['description']; // a php manual
Echo $ tags ['geo _ position']; // 49.33;-86.59
?>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.