PHP code example of git-mz / tagmatch

1. Go to this page and download the library: Download git-mz/tagmatch library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

git-mz / tagmatch example snippets


use tagmatch\Main;

$matcher = new Main();
$matcher->setTree([
    ['word' => '云朵', 'url' => 'https://www.yunduo.com'],
    ['word' => '七彩云朵', 'url' => 'https://www.qicaiyunduo.com'],
]);

$content = '我会脚踏云朵,哦不,是七彩云朵去娶你!';

$matches = $matcher->getTagWord($content);

$matches = $matcher->getTagWord($content, 3);

$result = $matcher->replace($content);

$result = $matcher->replace($content, '', true);

$result = $matcher->replace($content, 'class="tag-link" target="_blank"');