readonly

函式
readonly ( $readonly, $current = true, $echo = true )
引數
  • (mixed) $readonly One of the values to compare.
    Required:
  • (mixed) $current Optional. The other value to compare if not just true. Default true.
    Required:
    Default: true
  • (bool) $echo Optional. Whether to echo or just return the string. Default true.
    Required:
    Default: true
返回值
  • (string) HTML attribute or empty string.
相關
  • wp_readonly()
定義位置
相關方法
wp_readonlyrel_canonicalrandom_intadd_roleget_taxonomy
引入
4.9.0
棄用
5.9.0

readonly: 這是一個WordPress函式,用於設定HTML輸入欄位的只讀屬性: 這個函式通常用於防止使用者編輯某些表格欄位。

輸出HTML只讀屬性。

比較前兩個引數,如果相同則標記為只讀。

該函式已被棄用,不能在 PHP >= 8.1 上使用。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function readonly( $readonly, $current = true, $echo = true ) {
_deprecated_function( __FUNCTION__, '5.9.0', 'wp_readonly()' );
return wp_readonly( $readonly, $current, $echo );
}
function readonly( $readonly, $current = true, $echo = true ) { _deprecated_function( __FUNCTION__, '5.9.0', 'wp_readonly()' ); return wp_readonly( $readonly, $current, $echo ); }
function readonly( $readonly, $current = true, $echo = true ) {
	_deprecated_function( __FUNCTION__, '5.9.0', 'wp_readonly()' );
	return wp_readonly( $readonly, $current, $echo );
}

常見問題

FAQs
檢視更多 >