如何在PHP中调试语法错误:T_CONSTANT_ENCAPSED_STRING?

时间:2017-06-01 01:34:00

标签: php wordpress

我的网站存在一些问题。我最初有:

  

致命错误:允许的内存大小为x字节耗尽

但在我尝试修复之后,我现在遇到了一个新错误,我无法弄清楚出了什么问题。

所以这里是错误信息:解析错误:语法错误,意外T_CONSTANT_ENCAPSED_STRINGin / data / 9/3/38/56/3038056 / user / 3375037 / htdocs / healteam6 / wp-includes / default-constants.php在线45

以下是以下代码。

<?php
/**
 * Defines constants and global variables that can be overridden, generally in wp-config.php.
 *
 * @package WordPress
 */

/**
 * Defines initial WordPress constants
 *
 * @see wp_debug_mode()
 *
 * @since 3.0.0
 *
 * @global int $blog_id
 */
function wp_initial_constants() {
   global $blog_id;

/**#@+
 * Constants for expressing human-readable data sizes in their respective number of bytes.
 *
 * @since 4.4.0
 */
define( 'KB_IN_BYTES', 1024 );
define( 'MB_IN_BYTES', 1024 * KB_IN_BYTES );
define( 'GB_IN_BYTES', 1024 * MB_IN_BYTES );
define( 'TB_IN_BYTES', 1024 * GB_IN_BYTES );
/**#@-*/

$current_limit     = @ini_get( 'memory_limit' );
$current_limit_int = wp_convert_hr_to_bytes( $current_limit );

// Define memory limits.
if ( ! defined( 'WP_MEMORY_LIMIT' ) ) {
    if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
        define( 'WP_MEMORY_LIMIT', $current_limit );
    } elseif ( is_multisite() ) {
        define( 'WP_MEMORY_LIMIT', '64M' );
    } else {
        define( 'WP_MEMORY_LIMIT', ‘128M' );
    }
}

if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ) {
    if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
        define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
    } elseif ( -1 === $current_limit_int || $current_limit_int > 268435456 /* = 256M */ ) {
        define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
    } else {
        define( 'WP_MAX_MEMORY_LIMIT', '256M' );
    }
}

// Set memory limits.
$wp_limit_int = wp_convert_hr_to_bytes( WP_MEMORY_LIMIT );
if ( -1 !== $current_limit_int && ( -1 === $wp_limit_int || $wp_limit_int > $current_limit_int ) ) {
    @ini_set( 'memory_limit', WP_MEMORY_LIMIT );
}

if ( ! isset($blog_id) )
    $blog_id = 1;

if ( !defined('WP_CONTENT_DIR') )
    define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down

// Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development.
if ( !defined('WP_DEBUG') )
    define( 'WP_DEBUG', false );

// Add define('WP_DEBUG_DISPLAY', null); to wp-config.php use the globally configured setting for
// display_errors and not force errors to be displayed. Use false to force display_errors off.
if ( !defined('WP_DEBUG_DISPLAY') )
    define( 'WP_DEBUG_DISPLAY', true );

// Add define('WP_DEBUG_LOG', true); to enable error logging to wp-content/debug.log.
if ( !defined('WP_DEBUG_LOG') )
    define('WP_DEBUG_LOG', false);

1 个答案:

答案 0 :(得分:1)

这一行:

define( 'WP_MEMORY_LIMIT', ‘128M' );

128M之前有一个花哨的引用,将其更改为正确的引用:

define( 'WP_MEMORY_LIMIT', '128M' );