syntax error, unexpected T_GOTO, expecting T_STRING

◇◆丶佛笑我妖孽 提交于 2019-11-27 08:21:21

问题


I moved my website to another host. The previous php version is 5.2 and now is 5.3 When I login to my website, it shows the error:

Parse error: syntax error, unexpected T_GOTO, expecting T_STRING in /xx/xx/xx/xx on line xx

Following is the code, the first line is the error line:

    function goto($URL= "Back",$Target="self") //the error line
{
    if ($URL == "Back")
    {
        echo "<HTML>\n<HEAD>\n<TITLE> untitle </TITLE>\n<meta http-equiv=\"Content-Type\"  content=\"text/html; charset={$this -> Charset}\">\n</HEAD>\n<BODY>\n";
        echo "<Script Language=\"Javascript\">history.go(-1)</Script>";
        echo "\n</body></html>";
    }
    elseif

How should I change my syntax? Thanks a lot!


回答1:


rename your function to something other than "goto". That is a reserved name.




回答2:


For better or worse, goto is a reserved word in PHP 5.3.

http://php.net/manual/en/control-structures.goto.php



来源:https://stackoverflow.com/questions/7258697/syntax-error-unexpected-t-goto-expecting-t-string

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!