本文整理匯總了PHP中Inflector::hyphenToUnderscore方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inflector::hyphenToUnderscore方法的具體用法?PHP Inflector::hyphenToUnderscore怎麽用?PHP Inflector::hyphenToUnderscore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Inflector
的用法示例。
在下文中一共展示了Inflector::hyphenToUnderscore方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: normalize
protected static function normalize($request)
{
if (is_null($request)) {
$request = Mapper::parse();
}
$request['controller'] = Inflector::hyphenToUnderscore($request['controller']);
$request['action'] = Inflector::hyphenToUnderscore($request['action']);
return $request;
}
示例2: dispatch
/**
* Chama o controller e a action solicitadas pela URL.
*
* @return mixed Instância do novo controller ou falso em caso de erro
*/
public function dispatch()
{
$path = Mapper::parse();
$path["controller"] = Inflector::hyphenToUnderscore($path["controller"]);
$path["action"] = Inflector::hyphenToUnderscore($path["action"]);
$controller_name = Inflector::camelize($path["controller"]) . "Controller";
if ($controller =& ClassRegistry::load($controller_name, "Controller")) {
if (!can_call_method($controller, $path['action']) && !App::path("View", "{$path['controller']}/{$path['action']}.{$path['extension']}")) {
$this->error("missingAction", array("controller" => $path["controller"], "action" => $path["action"]));
return false;
}
} else {
if (App::path("View", "{$path['controller']}/{$path['action']}.{$path['extension']}")) {
$controller =& ClassRegistry::load("AppController", "Controller");
} else {
$this->error("missingController", array("controller" => $path["controller"]));
return false;
}
}
$controller->params = $path;
$controller->componentEvent("initialize");
$controller->beforeFilter();
$controller->componentEvent("startup");
if (in_array($path["action"], $controller->methods) && can_call_method($controller, $path["action"])) {
$params = $path["params"];
if (!is_null($path["id"])) {
$params = array_merge(array($path["id"]), $params);
}
call_user_func_array(array(&$controller, $path["action"]), $params);
}
if ($controller->autoRender) {
$controller->render();
}
$controller->componentEvent("shutdown");
echo $controller->output;
$controller->afterFilter();
return $controller;
}
示例3: tagButton
/**
* Centraliza a criação de botões. Pode ser um submit, um reset ou button
*
* @param string $type_field Tipo do botão a ser criado. Pode ser submit, button ou reset
* @param string $name_field O nome do botão
* @return $this
*/
public function tagButton($type_field, $name_field)
{
$this->input($type_field, $name_field, false);
$this->attr('value', Inflector::humanize($name_field))->attr('id', Inflector::hyphenToUnderscore(Inflector::slug($name_field)))->attr('name', Inflector::hyphenToUnderscore(Inflector::slug($name_field)));
return $this;
}