本文整理匯總了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);