force_ssl_admin()
最后更新于:2021-11-26 04:08:21
force_ssl_admin( string|bool$force=null)Whether to force SSL used for the Administration Screens.
参数
- $force
-
(string|bool) (Optional) Whether to force SSL in admin screens.
Default value: null
响应
(bool) True if forced, false if not forced.
源文件
文件: gc-includes/functions.php
function force_ssl_admin( $force = null ) {
static $forced = false;
if ( ! is_null( $force ) ) {
$old_forced = $forced;
$forced = $force;
return $old_forced;
}
return $forced;
}
<?php force_ssl_admin(true); if ( force_ssl_admin() ) { echo 'Administration should be performed over SSL'; } else { echo 'This code will never execute'; } force_ssl_admin(false); if ( force_ssl_admin() ) { echo 'This code will never execute'; } else { echo 'Administration should NOT be performed over SSL'; } ?>