thefold/wordpress-dispatcher

在WordPress中创建URL端点

2.1 2019-02-13 08:17 UTC

This package is not auto-updated.

Last update: 2024-09-24 09:12:51 UTC


README

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

示例

use \TheFold\WordPress\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 thefold/wordpress-dispatcher