wp-config.php文件上的Wordpress错误“语法错误,意外的'WP_DEBUG'(T_STRING)”

时间:2018-09-13 15:44:33

标签: php wordpress

我已经建立了许多wordpress网站,但从未见过此错误,我刚刚完成网站并将其移至最终的托管网站,却遇到此错误:

解析错误:语法错误,第74行出现意外的'WP_DEBUG'(T_STRING)

内容是:

<?php
/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the
 * installation. You don't have to use the web site, you can
 * copy this file to "wp-config.php" and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * MySQL settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://codex.wordpress.org/Editing_wp-config.php
 *
 * @package WordPress
 */

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'XXXXXXXXX' );

/** MySQL database username */
define( 'DB_USER', 'XXXXXXXXXX' );

/** MySQL database password */
define( 'DB_PASSWORD', 'XXXXXXXXXX' );

/** MySQL hostname */
define( 'DB_HOST', 'XXXXXXXXXXXXX' );

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define( 'AUTH_KEY',         'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' );
define( 'SECURE_AUTH_KEY',  'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' );
define( 'LOGGED_IN_KEY',    'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' );
define( 'NONCE_KEY',        'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' );
define( 'AUTH_SALT',        'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' );
define( 'SECURE_AUTH_SALT', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' );
define( 'LOGGED_IN_SALT',   'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' );
define( 'NONCE_SALT',       'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' );

/**#@-*/
/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix = 'xxxxx_’;

/**
 * Para desarrolladores: modo debug de WordPress.
 *
 * Cambia esto a true para activar la muestra de avisos durante el desarrollo.
 * Se recomienda encarecidamente a los desarrolladores de temas y plugins que usen WP_DEBUG
 * en sus entornos de desarrollo.
 */
define('WP_DEBUG', true);

/* ¡Eso es todo, deja de editar! Feliz blogging */

/** WordPress absolute path to the Wordpress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

有人看到这里缺少什么或错误在哪里? 谢谢大家!

2 个答案:

答案 0 :(得分:1)

请仔细查看定义表前缀的位置。分号彼此不同。在wp-config.php文件中,有时会发生这种情况,并引发错误。查看屏幕截图: enter image description here

答案 1 :(得分:0)

如果我创建一个简单的PHP文件(语法错误):

listener.security.protocol.map: |-
  PLAINTEXT:PLAINTEXT,EXTERNAL:SASL_PLAINTEXT

尝试执行它,出现以下错误:

PHP Parse error:  syntax error, unexpected 'WP_DEBUG' (T_STRING) in simple.php on line 4

因此,在调用<?php $table_prefix = 'wp_ define('WP_DEBUG', false); 之前,文件中某处有一个未终止的字符串分配。