函数原型
readonly( mixed $readonly, mixed $current = true, bool $echo = true ): string
函数描述
Outputs the HTML readonly attribute.
是否弃用
Warning: This function has been deprecated. Use wp_readonly() instead.
函数参数
-
$readonly
mixed
Required - One of the values to compare.
-
$current
mixed
Optional - The other value to compare if not just true.
Default:
true -
$echo
bool
Optional - Whether to echo or just return the string.
Default:
true
函数返回值
string HTML attribute or empty string.
函数位置
File: wp-includes/php-compat/readonly.php.
函数源码
function readonly( $readonly, $current = true, $echo = true ) {
_deprecated_function( __FUNCTION__, '5.9.0', 'wp_readonly()' );
return wp_readonly( $readonly, $current, $echo );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 5.9.0 | Use wp_readonly() introduced in 5.9.0. |
| 4.9.0 | Introduced. |

