【问题标题】:wordpress, blank lines at start of pagewordpress,页面开头的空白行
【发布时间】:2012-09-04 12:58:51
【问题描述】:

我已经使用 wordpress 开发了一个网站。它在本地机器(windows xp)和测试服务器(ubuntu)上运行良好。但是在实时服务器上,它给出的错误如下所示。在此之前和这些错误之后有 2 个空白行。在测试服务器上,我注意到启动中有两个空白行,但是它运行良好。

我尝试删除 header.php、index.php 和其他一些文件中的一些空白行,但没有成功。

直播网址是http://mbsocial.bsslsites.com

  <br />
    <b>Warning</b>:  session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /home/bsslsite/public_html/mbsocial/wp-includes/functions.php:4954) in <b>/home/bsslsite/public_html/mbsocial/wp-content/plugins/wp-e-commerce/wpsc-core/wpsc-constants.php</b> on line <b>16</b><br />
    <br />
    <b>Warning</b>:  session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /home/bsslsite/public_html/mbsocial/wp-includes/functions.php:4954) in <b>/home/bsslsite/public_html/mbsocial/wp-content/plugins/wp-e-commerce/wpsc-core/wpsc-constants.php</b> on line <b>16</b><br />


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
        <head profile="http://gmpg.org/xfn/11">
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

【问题讨论】:

    标签: php wordpress session


    【解决方案1】:

    从错误信息来看,我猜想在 wpsc-constants.php 中&lt;?php 之前有一些空格

    【讨论】:

    • 之前的 wpsc-constants.php 中没有空格
    • 你确定吗?没有换行符或空格或任何东西?你在任何地方回响任何东西吗?该文件的第 16 行是什么?
    • 是的,没有空格或任何东西。这是该文件中的代码&lt;?php // Left Overs $wpsc_currency_data = array(); $wpsc_title_data = array(); /** * wpsc_core_load_session() * * Load up the WPEC session */ function wpsc_core_load_session() { if ( !isset( $_SESSION ) ) $_SESSION = null; //error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING); if ( ( !is_array( $_SESSION ) ) xor ( !isset( $_SESSION['nzshpcrt_cart'] ) ) xor ( !$_SESSION ) ) session_start(); } /** * wpsc_core_constants() * * The core WPEC constants necessary to start loading */
    • 请您粘贴或编辑您的原始帖子以保留格式吗?
    • 另外,functions.php 的第 4954 行是什么?
    【解决方案2】:

    您显然需要修复错误。幸运的是,他们指出了问题的根源 - wpsc-constants.php 的第 16 行。

    您似乎还应该正确配置本地开发和测试环境以显示这些错误,并正确配置生产环境以不显示这些错误。

    【讨论】:

      【解决方案3】:

      出现这种情况的最常见情况是在设置标题信息(本例中为 cookie)之前向浏览器回显了一个空白字符或空白行。我的建议是尝试浏览主题的 functions.php 文件和 wp-e-commerce/wpsc-core/wpsc-constants.php 文件,并确保它们以 &lt;?php 开头 - 在此之前没有空格或换行符。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-12-30
        • 1970-01-01
        • 2017-06-15
        • 1970-01-01
        • 2016-05-29
        • 2012-02-21
        • 1970-01-01
        • 2019-08-24
        相关资源
        最近更新 更多