Dispatch 是一个小型的 PHP 框架(至少 PHP 5.4)。你可以通过它来定义URL规则和方法,以便更好组织应用程序。非常适合 API、简单的站点或原型开发。

示例代码:

<?php
// routing Functions
function on($method$path$callback)
function resource($name$cb)
function error($CODE$callback = null)
function before($callback)
function after($callback)
function filter($Symbol$callback)
function redirect($path$code = 302, $condition = true)
 
// vIEws, templates and responses
function render($view$locals = null, $layout = null)
function partial($view$locals = null)
function JSON_out($obj$func = null)
function nocache()
 
// request Data helpers
function params($name = null, $default = null)
function cookie($name$value = null, $expire = 0, $path '/')
function scope($name$value = null)
function upload($name)
function download($path$filename$sec_expire = 0)
function request_headers($name = null)
function request_body()
 
// configuRATions and settings
function config($key$value = null)
function site($path_only = false)
 
// misc helpers
function Flash($key$msg = null, $now = false)
function u($str)
function h($str$flags = ENT_QUOTES, $enc 'UTF-8')
function ip()
 
// entry POInt
function dispatch($method = null, $path = null)
?>
PHP微框架Dispatch简介
本文为大家介绍的是PHP微框架Dispatch简介,感兴趣的同学参考下。

发布于 2015-02-01 06:53:44 | 210 次阅读


Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务