本文整理匯總了PHP中Str::pure2html方法的典型用法代碼示例。如果您正苦於以下問題:PHP Str::pure2html方法的具體用法?PHP Str::pure2html怎麽用?PHP Str::pure2html使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Str
的用法示例。
在下文中一共展示了Str::pure2html方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: GetAsHTML
public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true)
{
return Str::pure2html((string) $sValue);
}
示例2: get_callstack
public static function get_callstack($iLevelsToIgnore = 0, $aCallStack = null)
{
if ($aCallStack == null) {
$aCallStack = debug_backtrace();
}
$aCallStack = array_slice($aCallStack, $iLevelsToIgnore);
$aDigestCallStack = array();
$bFirstLine = true;
foreach ($aCallStack as $aCallInfo) {
$sLine = empty($aCallInfo['line']) ? "" : $aCallInfo['line'];
$sFile = empty($aCallInfo['file']) ? "" : $aCallInfo['file'];
if ($sFile != '') {
$sFile = str_replace('\\', '/', $sFile);
$sAppRoot = str_replace('\\', '/', APPROOT);
$iPos = strpos($sFile, $sAppRoot);
if ($iPos !== false) {
$sFile = substr($sFile, strlen($sAppRoot));
}
}
$sClass = empty($aCallInfo['class']) ? "" : $aCallInfo['class'];
$sType = empty($aCallInfo['type']) ? "" : $aCallInfo['type'];
$sFunction = empty($aCallInfo['function']) ? "" : $aCallInfo['function'];
if ($bFirstLine) {
$bFirstLine = false;
// For this line do not display the "function name" because
// that will be the name of our error handler for sure !
$sFunctionInfo = "N/A";
} else {
$args = '';
if (empty($aCallInfo['args'])) {
$aCallInfo['args'] = array();
}
foreach ($aCallInfo['args'] as $a) {
if (!empty($args)) {
$args .= ', ';
}
switch (gettype($a)) {
case 'integer':
case 'double':
$args .= $a;
break;
case 'string':
$a = Str::pure2html(self::beautifulstr($a, 64, true, false));
$args .= "\"{$a}\"";
break;
case 'array':
$args .= 'array(' . count($a) . ')';
break;
case 'object':
$args .= 'Object(' . get_class($a) . ')';
break;
case 'resource':
$args .= 'Resource(' . strstr($a, '#') . ')';
break;
case 'boolean':
$args .= $a ? 'true' : 'false';
break;
case 'NULL':
$args .= 'null';
break;
default:
$args .= 'Unknown';
}
}
$sFunctionInfo = "{$sClass}{$sType}{$sFunction}({$args})";
}
$aDigestCallStack[] = array('File' => $sFile, 'Line' => $sLine, 'Function' => $sFunctionInfo);
}
return $aDigestCallStack;
}