意外的'$ redirect'(T_VARIABLE)

时间:2018-10-01 14:36:42

标签: php

你好,我总是遇到505 http错误的问题。 这是开始的代码:

<?php
include("FW\access_check.php");
$redirect = canAccess();

if ($redirect != null) {
    echo "hey => $redirect";
} else {
    echo "ciao?";
}
?>

我收到此错误:

  

PHP致命错误:调用未定义函数canaccess()   /var/www/html/index.php,第3行

我一直在寻找解决方案,然后我尝试在此处添加$ this:

<?php
include("FW\access_check.php");
$this $redirect= canAccess();

if ($redirect != null) {
    echo "hey => $this $redirect";
} else {
    echo "ciao?";
}
?>

但是我从主题中详细了解了错误:

  

PHP解析错误:语法错误,意外的'$ redirect'(T_VARIABLE)   在第3行的/var/www/html/index.php中

请告诉我如何解决我的问题!预先谢谢你!

1 个答案:

答案 0 :(得分:0)

您在第三行缺少一位操作员,请将您的代码更改为此:

    <?php
    include("FW\access_check.php");
    $this->$redirect= canAccess();

    if ($redirect != null) {
        echo "hey => $this $redirect";
    } else {
        echo "ciao?";
    }
?>
相关问题