You may not know PHP get_meta_tags () function _php Tutorial

Source: Internet
Author: User
definition and Usage:

get_meta_tags-extracts all meta tags from a file content property, returns an array

Grammar:

Copy the Code code as follows: Array get_meta_tags (string filename, int [use_include_path]);
#打开 filename to parse the label in the file by line . The parsing work will stop at the point.

Parameters Describe
FileName

Path string for HTML file

This parameter can be a local file or it can be a URL.

Example #1 Get_meta_tags () resolved what

(Note that the carriage return line-PHP uses a local function to parse the input, so the files on the MAC will not work on Unix).

Use_include_path Setting Use_include_path to TRUE will cause PHP to attempt to open the file with each point in the Include_path standard include path. This is used only for local files and not for URLs.

return value

Returns an array that contains all parsed meta tags.
The returned associative array takes the value of the property name as the key, the value of the properties content as the value, so you can easily traverse this associative array or access a value using a standard array function. The special characters in the property name are replaced with ' _ ', while the other characters are converted to lowercase. If there are two meta tags with the same name, only the last one that appears is returned.

Example

Copy the Code code as follows:
Assuming that the top label is in Www.jb51.net
$tags = get_meta_tags (' http://www.jb51.net ');

Note that all keys (key) are lowercase, and the key is '. ' is converted into ' _ '.
echo $tags [' author ']; DXY | Www.jb51.net
echo $tags [' keywords ']; Script, VBScript, regular expression, jquery,dos,bat, batch, javascript,photoshop,html,div+css,asp,php,asp.net
echo $tags [' description ']; Script Home is a professional website construction resources, scripting Learning Web site, providing ASP, PHP, ASP, JavaScript, jquery, VBScript, DOS batch processing, web production, network programming, website construction and other programming materials.

Special Instructions

Only meta tags that contain the name attribute will be parsed.

http://www.bkjia.com/PHPjc/769244.html www.bkjia.com true http://www.bkjia.com/PHPjc/769244.html techarticle definition and Usage: get_meta_tags-extracts all meta tag content properties from a file, returning an array syntax: Copy the code as follows: Array get_meta_tags (string f ...

  • Related Article

    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.