PHP警告-在wp-config.php上使用未定义的常量‘force_ssl_login’‘force_ssl_admin’

时间:2021-05-23 作者:Mahdi

我有一个困扰多年的PHP警告,我想知道是否有人能解决这个问题。以下两行警告不断记录在my error\\u日志文件中:

PHP Warning:  Use of undefined constant ‘FORCE_SSL_LOGIN’ - assumed \'‘FORCE_SSL_LOGIN’\' (this will throw an Error in a future version of PHP) in /home/myuser/public_html/wp-config.php on line 92

PHP Warning:  Use of undefined constant ‘FORCE_SSL_ADMIN’ - assumed \'‘FORCE_SSL_ADMIN’\' (this will throw an Error in a future version of PHP) in /home/myuser/public_html/wp-config.php on line 93
在wp配置中。php我对第92行和第93行有以下内容:

define(‘FORCE_SSL_LOGIN’, true);
define(‘FORCE_SSL_ADMIN’, true);
第91行为空,第90行为define(\'WP_DEBUG\', false);

更多信息:我的php版本:7.4.16;Webserver:LiteSpeed;cURL版本:7.74.0 OpenSSL/1.1.1k。

我在一年或两年多的时间里用不同版本的phps发出了这个警告

我在我的网站上也使用了非常简单的SSL插件,一切都很好。我也在我的网站上使用多功能一体安全和防火墙。

停用插件没有帮助。有什么解决办法吗?

2 个回复
SO网友:Ali Salamati

编辑wp配置文件:

define(\'FORCE_SSL_LOGIN\', true);
define(\'FORCE_SSL_ADMIN\', true);
只需复制此文件并粘贴到wp配置文件中。

祝你一切顺利

SO网友:Ümüt DEMİR
define( \'WP_HOME\', \'https://RanaAJANS.com/\' ); #httpS...
define( \'WP_SITEURL\', \'https://RanaAJANS.com/\' ); #httpS...
define( \'FORCE_SSL\', true); 
define( \'FORCE_SSL_ADMIN\', true); 
define( \'COOKIE_DOMAIN\', \'.RanaAJANS.com\');
@ini_set( \'session.cookie_httponly\', true);
@ini_set( \'session.cookie_secure\', true);
@ini_set( \'session.use_only_cookies\', true);
#header( \'X-Frame-Options: SAMEORIGIN\');

相关推荐

ADD_ACTION在所需的函数文件.php中不起作用

我试图将代码的一部分从函数中分离出来。php文件,使其更易于理解和维护。所以我想把我所有的;ajax“;不同PHP文件中的相关代码。这是我的功能中的要求。php文件:require_once( __DIR__ . \'/includes/ajax.php\'); 下面是ajax的一些内容。php文件:function theme_enqueue_ajax(){ wp_localize_script( \'myJSScript\', \'ajaxUrl\', array( \'ur