开发者

Fatal error: Cannot redeclare mss() (previously declared in *

I don't understand, the function doesn't exist, and even if I change it to some absurd names, it still doesn't work. Can anyone find the problem?

function mss($value){
    $data = mysql_real_escape_string(trim(strip_tags开发者_高级运维($value)));
    return $data;
}

EDIT: I forgot to mention, its XAMPP


That will mean that you've either defined the function in two separate spots, or your including the same file twice.

Use include_once/require_once instead of include/require.


Ben Rowe's answer is almost assuredly the reason why it's happening.

I don't recommend this but you can always wrap your function in function_exists()

if(!function_exists("mss")) {

    function mss($value){
        $data = mysql_real_escape_string(trim(strip_tags($value)));
        return $data;
    }

}

This solution is messy. It's almost always more preferable to find out WHY your file is being included twice or where this function is defined twice. But, for special circumstances this solution could be appropriate.


If you're keeping it in a separate file, are you including it more than once accidentally?


include_once (not include) works as long as you have the function declared one time only in a separate .php file. Please double check that the Function is not mentioned elsewhere .


You should : include_once instead of : include

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜