本文整理汇总了PHP中Handler::handle方法的典型用法代码示例。如果您正苦于以下问题:PHP Handler::handle方法的具体用法?PHP Handler::handle怎么用?PHP Handler::handle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Handler
的用法示例。
在下文中一共展示了Handler::handle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle the request.
*
* This approach by using a template method pattern ensures you that
* each subclass will not forget to call the successor. Beside, the returned
* boolean value indicates you if the request have been processed or not.
*
* @param Request $req
*
* @return bool
*/
public final function handle(Request $req)
{
$req->forDebugOnly = get_called_class();
$processed = $this->processing($req);
if (!$processed) {
// the request has not been processed by this handler => see the next
if (!is_null($this->successor)) {
$processed = $this->successor->handle($req);
}
}
return $processed;
}
示例2: main
/**
* @param $isHashHost Boolean Is this host a router
* @param $hostNumber Number How many host there
* @param $packImages Boolean make a zip pack for images?
*/
function main($isHashHost, $hostNumber, $packImages)
{
$url = isset($_GET['url']) ? $_GET['url'] : '';
# URL given
if ($url) {
# it's an image url
if (Input::isImageUrl($url)) {
Output::redirect($url);
} elseif ($isHashHost) {
Router::route($url, $hostNumber);
} else {
$mc = new mc();
Input::loadMemcached($mc);
Output::loadMemcached($mc);
Handler::loadMemcached($mc);
Handler::handle($url, $packImages);
}
} else {
exit_script('Hello Tumblr!');
}
}
示例3: docopt
/**
* API compatibility with python docopt
*/
function docopt($doc, $params = array())
{
$argv = array();
if (isset($params['argv'])) {
$argv = $params['argv'];
unset($params['argv']);
}
$h = new Handler($params);
return $h->handle($doc, $argv);
}
示例4: handle
"label": "created",
"field": "TtSampleDatum.created"
},
{
"label": "modified",
"field": "TtSampleDatum.modified"
}
],
"query" : "SELECT * FROM tt_sample_data"
}
}';
//$_POST['body'] = $json;
//$_POST['method'] = 'deleteReport';
$Handler = new Handler();
$Handler->setPost($_POST);
$Handler->handle();
class Handler
{
public function handle()
{
header('Content-Type: application/json');
print_r($this->response);
}
public function setPost($post)
{
$this->method = $post['method'];
$this->body = $post['body'];
$this->client = new Client();
switch ($this->method) {
case 'createReport':
$this->client->setData($this->body);