使用 PHP 的搜索引擎优化

v3.1.8 2024-09-21 19:35 UTC

README

Latest Stable Version Total Downloads Daily Downloads Monthly Downloads License PHP Version Require

搜索引擎优化包

版本

  • V1.x, V2.x 支持 PHP 所有版本 >=5.6
  • V3.x 支持 PHP 所有版本 >=7.0

用法

一些用于 SEO 网站的实用函数

获取 AddThis 脚本

<?php
echo add_this_script('add_this_id');

获取 Facebook 评论框

<?php
echo facebook_comments('url_comment');

Facebook 社交

<?php
require_once __DIR__ . '/vendor/autoload.php';
$fb = new \nguyenanhung\SEO\Social\Facebook();
$fb->setAppId('1234')
           ->setAdminId('456')
           ->setRedirectUrl('https://nguyenanhung.com');

// FB Share Link
$data = $fb->createShareLink('link')->getLink();

// FB Share Count
$data = $fb->graphShare('link')->shareCount();

// FB Comment Count
$data = $fb->graphShare('link')->commentCount();

Google Plus

<?php
require_once __DIR__ . '/vendor/autoload.php';
$google = new \nguyenanhung\SEO\Social\GooglePlus();

// FB Share Link
$data = $google->createShareLink('link')->getLink();

Twitter

<?php
require_once __DIR__ . '/vendor/autoload.php';
$twitter = new \nguyenanhung\SEO\Social\Twitter();

// FB Share Link
$data = $twitter->createShareLink('link')->getLink();

联系方式

如有任何需要讨论和了解的信息,请按照以下信息联系

从河内带着爱 <3