PHP code example of ke / buildrouter

1. Go to this page and download the library: Download ke/buildrouter 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/ */

    

ke / buildrouter example snippets


php think ke-buildrouter



namespace app\index\controller;

class Index
{
    /**
     * @param  string  $name 数据名称
     * @return mixed
     * @route('hello/:name')
     */
    public function hello($name)
    {
    	return 'hello,'.$name;
    }
}


namespace app\index\controller;

class Index
{
    /**
     * @param  string  $name 数据名称
     * @return mixed
     * @route('hello/:name','get')
     */
    public function hello($name)
    {
    	return 'hello,'.$name;
    }
}

// application/index/controller/Index.php
url('index/Index/index')

// application/index/controller/user/Message.php
url('index/user.Message/index')

// application/index/controller/UserMessage.php
url('index/UserMessage/index')