带有codeigniter的Wordpress内部出现致命错误

时间:2018-07-26 09:32:48

标签: php wordpress codeigniter

我想制作一个结合了wordpress和codeigniter的网站。像这样,我想加载一些从wordpress到codeigniter的视图。

我遵循了一个教程来操作教程中的wp-includes/load.php,现在,当我更新了wordpress load.php时,由于访问网络而遇到错误。下面的代码来自教程,它说,我需要更新wordpress的load.php

<?php
/** wp-includes/load.php */
/** Aproximately line 25 */
    // Variables that shouldn't be unset
    // Add whatever CI's cookie name or, '_SESSION'
    $no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix','ci_session' );
/** Approximately line 524 */
/** Add this function */
/**
 * Applies Magic Quotes to the $_COOKIE global but ignores Codeigniter's Cookie
 * @param  string $value Value passed by array_walk function
 * @param  string $key   Key passed by array_walk function
 */
function ci_ignore_magic_quotes($value,$key)
{
    if($key != "ci_session")
    {
        stripslashes_deep($value);
    }
}
/* Update this function */
/**
 * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER.
 *
 * Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE,
 * or $_ENV are needed, use those superglobals directly.
 *
 * @access private
 * @since 3.0.0
 */
function wp_magic_quotes() {
    // If already slashed, strip.
    if ( get_magic_quotes_gpc() ) {
        $_GET    = stripslashes_deep( $_GET    );
        $_POST   = stripslashes_deep( $_POST   );
        $_COOKIE = stripslashes_deep( $_COOKIE );
    }
    // Escape with wpdb.
    $_GET    = add_magic_quotes( $_GET    );
    $_POST   = add_magic_quotes( $_POST   );
    array_walk($_COOKIE, 'ci_ignore_magic_quotes');
    //$_COOKIE = add_magic_quotes( $_COOKIE );
    $_SERVER = add_magic_quotes( $_SERVER );
    // Force REQUEST to be GET + POST.
    $_REQUEST = array_merge( $_GET, $_POST );
}
?>

这是我遇到的错误:

Fatal error: Uncaught Error: Call to undefined function wp_convert_hr_to_bytes() in C:\xampp\htdocs\reservation\wp-includes\default-constants.php:33 Stack trace: #0 C:\xampp\htdocs\reservation\wp-settings.php(41): wp_initial_constants() #1 C:\xampp\htdocs\reservation\wp-config.php(89): require_once('C:\\xampp\\htdocs...') #2 C:\xampp\htdocs\reservation\wp-load.php(37): require_once('C:\\xampp\\htdocs...') #3 C:\xampp\htdocs\reservation\wp-blog-header.php(13): require_once('C:\\xampp\\htdocs...') #4 C:\xampp\htdocs\reservation\index.php(17): require('C:\\xampp\\htdocs...') #5 {main} thrown in C:\xampp\htdocs\reservation\wp-includes\default-constants.php on line 33

0 个答案:

没有答案