【问题标题】:PHP Fatal error: Cannot redeclare frm_dl() wordpressPHP 致命错误:无法重新声明 frm_dl() wordpress
【发布时间】:2013-03-29 20:00:00
【问题描述】:

我遇到了 500 内部服务器问题。 http://www.bunchmag.com/

500 internal server error Fatal error: Cannot redeclare frm_dl

20130329T141539:www.bunchmag.com/index.php PHP 致命错误:不能 重新声明 frm_dl() (之前在 /hermes/web09/aksjhfks/moo.bunchmagazinecom/bunch/index.php(1): eval()'d 代码:1) 在 /hermes/web09/skjfljf/moo.bunchmagazinecom/bunch/wp-config.php(1): eval()'d 代码在第 10 行

我的托管技术支持正在努力,但我们将不胜感激!

【问题讨论】:

  • 你能有 2 个或更多的函数名 frm_dl 吗?是多个插件,还是一个文件被包含两次?
  • 您是否有任何包含先前已声明的函数的自定义代码?如果您多次包含一个文件(您不应该这样做),请使用include_once 而不是include。它使 PHP 使用了一点智能来只包含一次文件。
  • 将函数包装在 if 语句中也可能会有所帮助: if(!function_exists("frm_dl") ){...}
  • wp-config.php 中的 #05 到 #15 行是什么?

标签: php wordpress


【解决方案1】:

找到要声明函数的位置,并将其包装在 if 语句中,以确保该函数尚未声明。

if( !function_exists( "frm_dl" ) ){
    function frm_dl(..){
        ...
    }
}

如果同一文件被包含两次,这应该可以解决问题。

或者,搜索多个声明函数的文件并将每个文件包装在条件语句中,或者更改函数名称(如果可能)

【讨论】:

    猜你喜欢
    • 2016-03-25
    • 1970-01-01
    • 2010-10-17
    • 2014-11-07
    • 1970-01-01
    • 2017-05-22
    • 1970-01-01
    • 2013-07-01
    相关资源
    最近更新 更多