本文整理汇总了PHP中Ak::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::debug方法的具体用法?PHP Ak::debug怎么用?PHP Ak::debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ak
的用法示例。
在下文中一共展示了Ak::debug方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Test_debug
function Test_debug()
{
ob_start();
Ak::debug($this->AkTestingObjectInspectionChildInstance);
$debug_str = ob_get_contents();
ob_end_clean();
$this->assertFalse($debug_str == '', 'Ak::debug not working properly');
}
示例2: debug
/**
* Outputs debug info given a PHP resource (vars, objects,
* arrays...)
*
* @access public
* @static
* @param mixed $data Data to debug. It can be an object, array,
* resource..
* @return void Prints debug info.
*/
function debug($data, $_functions = 0)
{
if (!AK_DEBUG && !AK_DEV_MODE) {
return;
}
if ($_functions != 0) {
$sf = 1;
} else {
$sf = 0;
}
if (is_object($data) && method_exists($data, 'debug')) {
echo AK_CLI ? "\n------------------------------------\nEntering on " . get_class($data) . " debug() method\n\n" : "<hr /><h2>Entering on " . get_class($data) . " debug() method</h2>";
if (!empty($data->__activeRecordObject)) {
$data->toString(true);
}
$data->debug();
return;
}
if (isset($data)) {
if (is_array($data) || is_object($data)) {
if (count($data)) {
echo AK_CLI ? "/--\n" : "<ol>\n";
while (list($key, $value) = each($data)) {
$type = gettype($value);
if ($type == "array" || $type == "object") {
ob_start();
Ak::debug($value, $sf);
$lines = explode("\n", ob_get_clean() . "\n");
foreach ($lines as $line) {
echo "\t" . $line . "\n";
}
} elseif (eregi("function", $type)) {
if ($sf) {
AK_CLI ? printf("\t* (%s) %s:\n", $type, $key, $value) : printf("<li>(%s) <b>%s</b> </li>\n", $type, $key, $value);
}
} else {
if (!$value) {
$value = "(none)";
}
AK_CLI ? printf("\t* (%s) %s = %s\n", $type, $key, $value) : printf("<li>(%s) <b>%s</b> = %s</li>\n", $type, $key, $value);
}
}
echo AK_CLI ? "\n--/\n" : "</ol>fin.\n";
} else {
echo "(empty)";
}
}
}
}
示例3: debug
function debug ($data = 'active_record_class', $_functions=0)
{
if(!AK_DEBUG && !AK_DEV_MODE){
return;
}
$data = $data == 'active_record_class' ? (AK_PHP5 ? clone($this) : $this) : $data;
if($_functions!=0) {
$sf=1;
} else {
$sf=0 ;
}
if (isset ($data)) {
if (is_array($data) || is_object($data)) {
if (count ($data)) {
echo AK_CLI ? "/--\n" : "<ol>\n";
while (list ($key,$value) = each ($data)) {
if($key{0} == '_'){
continue;
}
$type=gettype($value);
if ($type=="array") {
AK_CLI ? printf ("\t* (%s) %s:\n",$type, $key) :
printf ("<li>(%s) <b>%s</b>:\n",$type, $key);
ob_start();
Ak::debug ($value,$sf);
$lines = explode("\n",ob_get_clean()."\n");
foreach ($lines as $line){
echo "\t".$line."\n";
}
}elseif($type == "object"){
if(method_exists($value,'hasColumn') && $value->hasColumn($key)){
$value->toString(true);
AK_CLI ? printf ("\t* (%s) %s:\n",$type, $key) :
printf ("<li>(%s) <b>%s</b>:\n",$type, $key);
ob_start();
Ak::debug ($value,$sf);
$lines = explode("\n",ob_get_clean()."\n");
foreach ($lines as $line){
echo "\t".$line."\n";
}
}
}elseif (eregi ("function", $type)) {
if ($sf) {
AK_CLI ? printf ("\t* (%s) %s:\n",$type, $key, $value) :
printf ("<li>(%s) <b>%s</b> </li>\n",$type, $key, $value);
}
} else {
if (!$value) {
$value="(none)";
}
AK_CLI ? printf ("\t* (%s) %s = %s\n",$type, $key, $value) :
printf ("<li>(%s) <b>%s</b> = %s</li>\n",$type, $key, $value);
}
}
echo AK_CLI ? "\n--/\n" : "</ol>fin.\n";
} else {
echo "(empty)";
}
}
}
}