private function dispatch() { $routes = BASE_PATH . '/app/routes.php'; if (file_exists($routes)) { require $routes; } Route::dispatch(); }
<?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 /** * Created by PhpStorm. * User: meathill * Date: 14/11/12 * Time: 下午5:24 */ use NoahBuscher\Macaw\Macaw; Macaw::get(BASE . '', 'diy\\controller\\HomeController@home'); Macaw::get(BASE . 'dashboard/', 'diy\\controller\\HomeController@dashboard'); Macaw::options(BASE . 'file/', 'diy\\controller\\BaseController@on_options'); Macaw::post(BASE . 'file/', 'diy\\controller\\FileController@upload'); Macaw::options(BASE . 'fetch/', 'diy\\controller\\BaseController@on_options'); Macaw::post(BASE . 'fetch/', 'diy\\controller\\FileController@fetch'); Macaw::error(function () { echo '404 :: Not Found'; });
<?php /** * Created by PhpStorm. * User: meathill * Date: 14/12/23 * Time: 下午3:38 */ use NoahBuscher\Macaw\Macaw; Macaw::get(BASE . 'notice/', 'diy\\controller\\NoticeController@get_list'); Macaw::options(BASE . 'notice/(:any)', 'diy\\controller\\BaseController@on_options'); Macaw::delete(BASE . 'notice/(:any)', 'diy\\controller\\NoticeController@delete');
<?php /** * Created by PhpStorm. * User: meathill * Date: 14/11/15 * Time: 下午6:02 */ use NoahBuscher\Macaw\Macaw; Macaw::get(BASE . 'ad/', 'diy\\controller\\ADController@get_list'); Macaw::get(BASE . 'ad/(:any)', 'diy\\controller\\ADController@init'); Macaw::get(BASE . 'ad_basic/', 'diy\\controller\\ADController@get_list_basic'); Macaw::options(BASE . 'ad/(:any)', 'diy\\controller\\BaseController@on_options'); Macaw::post(BASE . 'ad/(:any)', 'diy\\controller\\ADController@create'); Macaw::patch(BASE . 'ad/(:any)', 'diy\\controller\\ADController@update'); Macaw::delete(BASE . 'ad/(:any)', 'diy\\controller\\ADController@delete'); Macaw::get(BASE . 'ad/(:any)/upload/', 'diy\\controller\\ADController@get_upload_history'); Macaw::get(BASE . 'apply/', 'diy\\controller\\ApplyController@get_list'); Macaw::options(BASE . 'apply/(:any)', 'diy\\controller\\BaseController@on_options'); Macaw::patch(BASE . 'apply/(:any)', 'diy\\controller\\ApplyController@update'); Macaw::delete(BASE . 'apply/(:any)', 'diy\\controller\\ApplyController@delete'); Macaw::get(BASE . 'info/', 'diy\\controller\\HistoryInfo@get_list'); Macaw::post(BASE . 'baobei/(:any)', 'diy\\controller\\ADController@resend_baobei_email'); Macaw::get(BASE . 'data-load/(:any)', 'diy\\controller\\ADController@data_load'); Macaw::get(BASE . 'competitor_ad/', 'diy\\controller\\CompetitorAdController@get'); Macaw::options(BASE . 'competitor_ad/(:any)', 'diy\\controller\\BaseController@on_options'); Macaw::patch(BASE . 'competitor_ad/(:any)', 'diy\\controller\\CompetitorAdController@update');
/** * Created by PhpStorm. * User: meathill * Date: 14/11/16 * Time: 下午3:29 */ use NoahBuscher\Macaw\Macaw; Macaw::get(BASE . 'stat/', 'diy\\controller\\StatController@get_ad_stat'); Macaw::get(BASE . 'stat/(:any)', 'diy\\controller\\StatController@get_the_ad_stat'); Macaw::get(BASE . 'stat/(:any)/(:any)', 'diy\\controller\\StatController@get_ad_daily_stat'); Macaw::get(BASE . 'stat/analyse/', 'diy\\controller\\StatController@get_daily_stat'); Macaw::get(BASE . 'stat/analyse/daily/(:any)', 'diy\\controller\\StatController@get_daily_ad'); Macaw::get(BASE . 'stat/export_payment/', 'diy\\controller\\StatController@export_payment'); Macaw::options(BASE . 'invoice/', 'diy\\controller\\BaseController@on_options'); Macaw::get(BASE . 'invoice/', 'diy\\controller\\InvoiceController@get_list'); Macaw::options(BASE . 'invoice/(:any)', 'diy\\controller\\BaseController@on_options'); Macaw::post(BASE . 'invoice/(:any)', 'diy\\controller\\InvoiceController@create'); Macaw::get(BASE . 'invoice/(:any)', 'diy\\controller\\InvoiceController@init'); Macaw::patch(BASE . 'invoice/(:any)', 'diy\\controller\\InvoiceController@update'); Macaw::delete(BASE . 'invoice/(:any)', 'diy\\controller\\InvoiceController@delete'); Macaw::options(BASE . 'invoice/ad/(:any)', 'diy\\controller\\BaseController@on_options'); Macaw::patch(BASE . 'invoice/ad/(:any)', 'diy\\controller\\InvoiceController@update_invoice_ad'); Macaw::get(BASE . 'invoice/settle/(:any)', 'diy\\controller\\InvoiceController@get_transfer_ad'); Macaw::get(BASE . 'adStat/(:any)/', 'diy\\controller\\ADStatController@get_stat'); Macaw::get(BASE . 'adStat/(:any)/comment/', 'diy\\controller\\ADStatController@get_stat_comments'); Macaw::get(BASE . 'adStat/(:any)/date/(:any)', 'diy\\controller\\ADStatController@get_stat_by_date'); Macaw::get(BASE . 'adStat/(:any)/apk/(:any)', 'diy\\controller\\ADStatController@get_stat_by_apk'); Macaw::get(BASE . 'adStat/(:any)/loc/(:any)', 'diy\\controller\\ADStatController@get_stat_by_loc'); Macaw::get(BASE . 'adStat/(:any)/hour/(:any)', 'diy\\controller\\ADStatController@get_stat_by_hour');
<?php /** * 处理用户相关的请求 * Created by PhpStorm. * User: meathill * Date: 14/11/13 * Time: 下午3:04 */ use NoahBuscher\Macaw\Macaw; Macaw::get(BASE . 'auth/', 'diy\\controller\\UserController@get_info'); Macaw::options(BASE . 'auth/', 'diy\\controller\\BaseController@on_options'); Macaw::delete(BASE . 'auth/', 'diy\\controller\\UserController@logout'); Macaw::post(BASE . 'auth/', 'diy\\controller\\UserController@login'); Macaw::patch(BASE . 'auth/', 'diy\\controller\\UserController@update'); Macaw::get(BASE . 'auth/finance/', 'diy\\controller\\UserController@get_my_finance');
<?php /** * Created by PhpStorm. * User: meathill * Date: 15/5/19 * Time: 上午10:58 */ use NoahBuscher\Macaw\Macaw; Macaw::options(BASE . 'agreement/(:any)', 'diy\\controller\\BaseController@on_options'); Macaw::patch(BASE . 'agreement/(:any)', 'diy\\controller\\AgreementController@renew'); Macaw::get(BASE . 'agreement/', 'diy\\controller\\AgreementController@get_list');
<?php /** * Created by PhpStorm. * User: meathill * Date: 15/5/19 * Time: 上午10:58 */ use NoahBuscher\Macaw\Macaw; Macaw::options(BASE . 'channel/', 'diy\\controller\\BaseController@on_options'); Macaw::post(BASE . 'channel/', 'diy\\controller\\ChannelController@create'); Macaw::get(BASE . 'channel/', 'diy\\controller\\ChannelController@get_list'); Macaw::options(BASE . 'channel/(:any)', 'diy\\controller\\BaseController@on_options'); Macaw::patch(BASE . 'channel/(:any)', 'diy\\controller\\ChannelController@update'); Macaw::delete(BASE . 'channel/(:any)', 'diy\\controller\\ChannelController@delete'); Macaw::options(BASE . 'crm/', 'diy\\controller\\BaseController@on_options'); Macaw::get(BASE . 'crm/', 'diy\\controller\\ChannelController@get_ads');
public function run($baseNamespace = null) { if ($this->runningInConsole()) { return $this->runCall($baseNamespace); } else { require static::$data_root . '/conf/routes.php'; Route::error(function () use($baseNamespace) { return $this->runCall($baseNamespace); }); Route::dispatch(); //return $this->runCall($baseNamespace); } }
* @link http://www.axiong.me * @version $Id$ * @lastmodified: 2014-06-16 14:41 * */ use NoahBuscher\Macaw\Macaw as Route; use Nickfan\AppBox\Common\BoxConstants; use Nickfan\BoxApp\Support\Facades\BoxDispatcher; use Nickfan\BoxApp\Support\Facades\BoxView; Route::get('/favicon.ico', function () { $content = base64_decode(BoxConstants::TRANSGIFDATA); $contentType = 'image/gif'; header('Content-Type: ' . $contentType); header('Content-Length: ' . strlen($content)); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); echo $content; exit; }); Route::get('/', function () { return BoxView::make('hello')->render(); }); Route::get('/hello', function () { echo 'Welcome to AppBox' . '<br>' . PHP_EOL; echo BoxDispatcher::getHost() . '<br>' . PHP_EOL; echo BoxDispatcher::getDomain() . '<br>' . PHP_EOL; }); Route::get('/box', '\\App\\Boxcontrollers\\Localhost\\Index\\Index@Index'); Route::get('/ping', '\\App\\Boxcontrollers\\Localhost\\Index\\Index@Ping');
public function run() { Route::dispatch(); }