本文整理匯總了PHP中TimeDate::human方法的典型用法代碼示例。如果您正苦於以下問題:PHP TimeDate::human方法的具體用法?PHP TimeDate::human怎麽用?PHP TimeDate::human使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TimeDate
的用法示例。
在下文中一共展示了TimeDate::human方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: logic
//.........這裏部分代碼省略.........
$return = date("H:i", strtotime($object));
break;
case "month":
$return = date("m", strtotime($object));
break;
case "fullmonth":
$return = date("F", strtotime($object));
break;
case "year":
$return = date("Y", strtotime($object));
break;
case "age":
//$return = abs(mktime(0,0,0,date("m",strtotime($object)),date("d",strtotime($object)),date("Y",strtotime($object))) - mktime(4,12,0,date("m"),date("d"),date("Y")) )/(60 * 60 * 24 * 356);
$return = date("Y") - date("Y", strtotime($object));
if (date("m", strtotime($object)) > date("m") || date("m", strtotime($object)) == date("m") && date("d", strtotime($object)) > date("d")) {
$return--;
}
break;
case "date":
$return = date("d", strtotime($object));
break;
/* mailto */
/* mailto */
case "mailto":
$return = mail_tag($object);
break;
case "empty":
$return = intval($object == NULL);
break;
case "elapsed":
import("date.TimeDate");
$return = TimeDate::elapsed($object);
break;
case "human":
import("date.TimeDate");
$return = TimeDate::human($object);
break;
case "count":
if (is_array($object)) {
$return = intval(count($object));
} else {
if (is_string($object)) {
$return = strlen($object);
} else {
$return = 0;
}
}
break;
case "toup":
$return = strToUpper($object);
break;
case "tolow":
$return = strToLower($object);
break;
case "resume":
array_splice($parameters, 0, 0, $object);
$return = call_user_func_array("resume", $parameters);
break;
case "custom":
//array_splice($parameters,0,0,$object);
$mth = array_shift($parameters);
$return = call_user_func_array($mth, $object);
break;
case "min":
$min1 = array_shift($parameters);
$return = min($min1, $object);