本文整理汇总了PHP中Env::getHelperPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Env::getHelperPath方法的具体用法?PHP Env::getHelperPath怎么用?PHP Env::getHelperPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Env
的用法示例。
在下文中一共展示了Env::getHelperPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: useHelper
/**
* Use specific helper
*
* @access public
* @param string $helper Helper name
* @return boolean
* @throws FileDnxError
*/
static function useHelper($helper, $plugin = null) {
$helper_file = Env::getHelperPath($helper, $plugin);
// If we have it include, else throw exception
if(is_file($helper_file)) {
include_once $helper_file;
return true;
} else {
throw new FileDnxError($helper_file, "Helper '$helper' does not exists (expected location '$helper_file')");
} // if
} // useHelper
示例2: useHelper
/**
* Use specific helper
*
* @access public
* @param string $helper Helper name
* @return boolean
* @throws FileDnxError
*/
static function useHelper($helper, $controller_name = null)
{
trace(__FILE__, "useHelper({$helper}, {$controller_name})");
$helper_file = Env::getHelperPath($helper, $controller_name);
// If we have it include, else throw exception
if (is_file($helper_file)) {
trace(__FILE__, "useHelper({$helper}, {$controller_name}) including {$helper_file}");
include_once $helper_file;
return true;
}
// if
throw new FileDnxError($helper_file, "Helper '{$helper}' does not exists (expected location '{$helper_file}')");
}