cosmos/metatag

制作HTML 'meta'标签的有用库类。

v3.0.0 2020-01-04 03:52 UTC

This package is auto-updated.

Last update: 2024-09-04 16:19:11 UTC


README

制作HTML <meta>标签的有用库类。

安装

composer require cosmos/metatag

用法

基本

use Cosmos\MetaTag\MetaTag;

$data = [
  'description' => "A helper class for making html meta tag.",
  'author' => 'John',
  'keywords' => ['PHP', 'Composer', 'Code', 'Github']
];

$metaTag = new MetaTag($data);

echo $metaTag->display();
// <meta property="description" content="A helper class for making html meta tag.">
// <meta property="author" content="John">
// <meta property="keywords" content="PHP,Composer,Code,Github">

访问属性

use Cosmos\MetaTag\MetaTag;

$meta = new MetaTag($data);

// add or modify properties.
$meta->author = "James";
$meta->set('name', 'another content');

// get property.
$name = $meta->get('name');

// remove property
$meta->remove('name');

许可

MIT许可