<?php /** * Created by PhpStorm. * User: huxiuchang * Date: 15-9-17 * Time: 下午1:38 */ use NoahBuscher\Macaw\Macaw; Macaw::get('', 'HomeController@home'); Macaw::get('test', function () { echo "成功!"; }); Macaw::$error_callback = function () { throw new Exception("路由无匹配项 404 Not Found"); }; Macaw::dispatch();
<?php /** * Routes 路由规则 * @author jceee * @createTime 2015-08-09 */ use NoahBuscher\Macaw\Macaw; Macaw::get('/', 'IndexController@index'); // Macaw::get('/', function() { // echo 'Hello world!'; // }); // Macaw::get('/(:any)', function($slug) { // echo 'The slug is: ' . $slug; // }); Macaw::post('/', function () { echo 'I <3 POST commands!'; }); Macaw::get('/hehe', function () { echo 'hehe'; }); Macaw::get('/mail', 'IndexController@testMail'); // Macaw::error(function() { // echo '404 :: Not Found'; // }); Macaw::$error_callback = function () { throw new Exception("路由无匹配顶 404 not found"); }; Macaw::dispatch();