承接 mauris/htmlmeta 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mauris/htmlmeta

Composer 安装命令:

composer require mauris/htmlmeta

包简介

HTML meta reader/writer

README 文档

README

#HtmlMeta

HtmlMeta provides abstraction for HTML meta tag reading and writing in PHP. You can directly use this library to generate out or parse meta tags in HTML content, or use OpenGraph or Twitter Cards implementation of HtmlMeta to enrich your Search Engine Optimisation and user experience.

##Installation

You can install HtmlMeta via Composer as mauris/htmlmeta. See https://packagist.org/packages/mauris/htmlmeta.

##Writing <meta>

<?php

use HtmlMeta\Writer;

$writer = new Writer();

$writer->add(new Meta(array('charset' => 'utf8')));
$writer->add(new Meta(array('name' => 'description', 'content' => 'some description')));

echo $writer->render();

Outputs to:

<meta charset="utf8" />
<meta name="description" content="some description" />

##Reading <meta>

<?php

use HtmlMeta\Reader;

$reader = new Reader();
$data = $reader->parse(file_get_contents('http://www.nytimes.com/2013/07/09/world/middleeast/egypt.html'));
print_r($data);

Outputs to:

Array
(
    [0] => HtmlMeta\Meta Object
        (
            [attributes:protected] => Array
                (
                    [http-equiv] => Content-Type
                    [content] => text/html; charset=utf-8
                )

        )

    [1] => HtmlMeta\Meta Object
        (
            [attributes:protected] => Array
                (
                    [itemprop] => inLanguage
                    [content] => en-US
                )

        )

    [2] => HtmlMeta\Meta Object
        (
            [attributes:protected] => Array
                (
                    [itemprop] => description
                    [name] => description
                    [content] => In a sharp escalation of tensions Monday, Egyptian soldiers opened fire on hundreds of supporters of Mohamed Morsi, the ousted president, witnesses said. The military said armed assailants fired first.
                )

        )
...
)

统计信息

  • 总下载量: 17
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2013-07-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固