wenprise / wordpress-dispatcher

在WordPress中创建URL端点

2.2 2024-08-22 06:19 UTC

This package is auto-updated.

Last update: 2024-09-22 06:35:35 UTC


README

轻松在WordPress中添加自定义URL端点。将一个URL映射到一个函数。

##示例

use \Wenprise\Dispatcher\Router;

Router::routes([

    'testing-a-url' => function(){
        echo 'Hello Ted';
    },

    'hello-([a-z]+)' => function($request, $name){
        echo "Hello $name";
    }
]);

/testing-a-url & /hello-dougle 将现在可以在您的WordPress站点中访问。

##安装

###Composer

composer require wenprise/wordpress-dispatcher