PHP get_meta_tags()

📔 : PHP 🔗

get_meta_tags() function , किसी valid URL या file से सभी meta tag content attributes extract करके एक Associative Array return करता है।

PHP get_meta_tags Syntax

get_meta_tags ( string $filename , bool $use_include_path = false );
  1. string $filename | required : targeted HTML file path या कोई भी valid URL pass कर सकते हैं।

  2. Return Value : सभी meta tags का एक Associative Array return होता है , जिसमे meta name Array key हो जाता है और content attribute value Array value हो जाती है।

    Note : अगर कोई meta tag same नाम का है तो last वाला ही evaluate होगा।

PHP get_meta_tags Example

<?php 
   print_r(get_meta_tags("https://www.learnhindituts.com")); 
?>

Output
[viewport] => width=device-width, initial-scale=1, shrink-to-fit=no [keywords] => php, jquery, javascript, json ,php in hindi, javascript in hindi, jquery in hindi, json in hindi, what is php, what is php in hindi , what is jquery, what is jquery in hindi, what is javascript, what is javascript in hindi, php hindi tutorials, js hindi tutorials , jquery hindi tutorials [description] => learnhindituts.com एक हिंदी tutorials website है जहाँ पर आप PHP, JavaScript, JQuery, JSON etc. languages को examples के साथ पढ़ पाएंगे [robots] => index, follow [googlebot] => index, follow [bingbot] => index, follow [twitter:title] => Learn Hindi Tutorials Home | learnhindituts [twitter:description] => learnhindituts.com एक हिंदी tutorials website है जहाँ पर आप PHP, JavaScript, JQuery, JSON etc. languages को examples के साथ पढ़ पाएं है। [twitter:image] => /assets/favicon.png [twitter:card] => summary [twitter:site] => @learnhindituts [twitter:domain] => www.learnhindituts.com [twitter:creator] => @learnhindituts [theme-color] => #44b78b [apple-mobile-web-app-capable] => yes [apple-mobile-web-app-status-bar-style] => black

यह सिर्फ HTML <head> </head> Tag के अंदर लिखे meta tags ही return करता है , अगर meta tags नहीं हैं तो empty Array return होता है।

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook