PHP错误:函数名称必须是字符串 [英] PHP Error: Function name must be a string

查看:62
本文介绍了PHP错误:函数名称必须是字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP代码的顶部添加了以下几行,但是会引发错误:

I added the following lines to the top of my PHP code, but it throws an error:

致命错误:函数名称必须是第2行/home/reg.php中的字符串

Fatal error: Function name must be a string in /home/reg.php on line 2

<?php
if ($_COOKIE('CaptchaResponseValue') == "false")
{
    header('location:index.php');
    return;
}
?>

我尝试过:$_COOKIE("CaptchaResponseValue"). cookie已成功设置并且可用.为什么在使用$_COOKIE时会给我一个错误?

I tried: $_COOKIE("CaptchaResponseValue"). The cookie is successfully set and is available. Why is it giving me an error when I am using $_COOKIE?

推荐答案

应为$_COOKIE['name'],而不是$_COOKIE('name')

$_COOKIE是一个数组,而不是一个函数.

$_COOKIE is an array, not a function.

这篇关于PHP错误:函数名称必须是字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆