本文整理汇总了PHP中dm::getRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP dm::getRequest方法的具体用法?PHP dm::getRequest怎么用?PHP dm::getRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dm
的用法示例。
在下文中一共展示了dm::getRequest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFullWebPath
public function getFullWebPath()
{
return dm::getRequest()->getAbsoluteUrlRoot() . '/' . $this->getWebPath();
}
示例2: getAbsoluteHref
public function getAbsoluteHref()
{
$href = $this->getHref();
$uriPrefix = dm::getRequest()->getUriPrefix();
if (strpos($href, $uriPrefix) !== 0) {
$href = $uriPrefix . $href;
}
return $href;
}
示例3: debugger
protected static function debugger($var, $level = 1, $opt = array())
{
$CR = "\n";
$die = $level > 2;
$opt = dmString::toArray($opt);
if (!sfConfig::get('sf_debug') && !dmArray::get($opt, "force")) {
return;
}
$tag = dmArray::get($opt, "tag", "pre");
if (dmArray::get($opt, "to_string", false) && is_array($var)) {
array_walk_recursive($var, create_function('&$val', 'if(is_object($val)) {
if (method_exists($val, "toString")) {
$val = get_class($val)." : ".$val->toString();
}
elseif (method_exists($val, "__toString")) {
$val = get_class($val)." : ".$val->__toString();
}
}'));
} elseif (is_array($var)) {
array_walk_recursive($var, create_function('&$val', 'if(is_object($val)) {
if (method_exists($val, "toDebug")) {
$val = get_class($val)." : ".print_r($val->toDebug(), true);
}
elseif (method_exists($val, "toArray")) {
$val = get_class($val)." : ".print_r($val->toArray(), true);
}
}'));
}
if (dmConfig::isCli()) {
$debugString = print_r($var, true);
$debugString = substr($debugString, 0, self::MAX_DEBUG_LENGTH);
echo $debugString;
if (strlen($debugString) > self::MAX_DEBUG_LENGTH) {
echo "\n---TRUNCATED---\n";
}
if ($die) {
die;
}
} else {
array_walk_recursive($var, create_function('&$val', 'if(is_string($val)) { $val = htmlspecialchars($val); }'));
if (count($var) == 1) {
$var = dmArray::first($var);
}
if (dmContext::hasInstance() && ($request = dm::getRequest())) {
if ($request->isXmlHttpRequest()) {
echo "\n<{$tag}>";
$debugString = print_r($var, true);
echo substr($debugString, 0, self::MAX_DEBUG_LENGTH);
if (strlen($debugString) > self::MAX_DEBUG_LENGTH) {
echo "\n---TRUNCATED---\n";
}
echo "</{$tag}>\n";
if ($die) {
die;
}
return;
}
}
ob_start();
if ($level > 1) {
print '<br /><' . $tag . ' style="text-align: left; border: 1px solid #aaa; border-left-width: 10px; background-color: #f4F4F4; color: #000; margin: 3px; padding: 3px; font-size: 11px;">';
$debugString = print_r($var, true);
echo substr($debugString, 0, self::MAX_DEBUG_LENGTH);
if (strlen($debugString) > self::MAX_DEBUG_LENGTH) {
echo "\n---TRUNCATED---\n";
}
print "</{$tag}>";
}
$buffer = ob_get_clean();
if ($level == 4) {
ob_start();
echo '<pre>';
debug_print_backtrace();
echo '</pre>';
$dieMsg = ob_get_clean();
} else {
$backtrace = debug_backtrace();
$dieMsg = str_replace(sfConfig::get("sf_root_dir"), "", dmArray::get($backtrace[1], 'file')) . " l." . dmArray::get($backtrace[1], 'line');
// $dieMsg = '<pre>';
// $dieMsg .= isset($backtrace[0]['file']) ? '> file : <b>'.
// $backtrace[1]['file'] .'</b>'. $CR : '';
// $dieMsg .= isset($backtrace[0]['line']) ? '> line : <b>'.
// $backtrace[1]['line'] .'</b>'. $CR : '';
// $dieMsg .= isset($backtrace[1]['class']) ? '> class : <b>'.
// dmArray::get(dmArray::get($backtrace, 2, array()), 'class') .'</b>'. $CR : '';
// $dieMsg .= isset($backtrace[1]['function']) ? '> function : <b>'.
// dmArray::get(dmArray::get($backtrace, 2, array()), 'function') .'</b>'. $CR : '';
// $dieMsg .= '</pre>';
}
if ($level > 1) {
print $buffer;
if ($die) {
die($dieMsg);
} else {
print $dieMsg;
}
} else {
sfWebDebug::getInstance()->logShortMessage($buffer . $dieMsg);
}
}
//.........这里部分代码省略.........