Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将开放图元标记添加到我的PHP代码中_Php_Drupal - Fatal编程技术网

将开放图元标记添加到我的PHP代码中

将开放图元标记添加到我的PHP代码中,php,drupal,Php,Drupal,新手程序员寻找指导。我想向我的网站添加Open Graph标记,如Open Graph所指定。我查看了Drupal主题中.php文件中调用meta标记的位置。如何格式化html代码以在php文件中工作?对不起,我知道这是个初学者的问题 OPEN GRAPH提供的HTML代码 <html prefix="og: http://ogp.me/ns#"> <head> <title>The Rock (1996)</title> <meta pro

新手程序员寻找指导。我想向我的网站添加Open Graph标记,如Open Graph所指定。我查看了Drupal主题中.php文件中调用meta标记的位置。如何格式化html代码以在php文件中工作?对不起,我知道这是个初学者的问题

OPEN GRAPH提供的HTML代码

<html prefix="og: http://ogp.me/ns#">
<head>
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" 
似乎
#属性
数组应该有类似于
'property'=>'og:title'
的内容。请参阅。似乎
#属性
数组应该有类似于
'property'=>'og:title'
的内容。请参阅。
/* Add various META tags to HTML head. */
    function montreal_preprocess_html(&$vars){
      global $root;
      $meta_title = array(
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#weight' => 1,
        '#attributes' => array(
          'name' => 'title',
          'content' => theme_get_setting('seo_title')
        )
      );

      $meta_description = array(
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#weight' => 2,
        '#attributes' => array(
          'name' => 'description',
          'content' => theme_get_setting('seo_description')
        )
      );

      $meta_keywords = array(
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#weight' => 3,
        '#attributes' => array(
          'name' => 'keywords',
          'content' => theme_get_setting('seo_keywords')
        )
      );