开发者

old function don't work in php 5.35

开发者 https://www.devze.com 2023-04-07 22:45 出处:网络
function goto($herf) { echo (\"<script>window.location.href=\'\".$h开发者_如何学Cerf.\"\'</script>\");
function goto($herf) {
    echo ("<script>window.location.href='".$h开发者_如何学Cerf."'</script>");
}

the above function work well before php 5.3.5, after i upgrade my php to 5.3.5, the following error displayed.

Parse error: syntax error, unexpected T_GOTO, expecting T_STRING or '(' in C:\xampp\htdocs\directory\directory\directory\directory\file.php on line 9

what is that error refer?


They added goto to the php language, which makes it a reserved word and no longer available as a function name.

The goto operator is available as of PHP 5.3.


So solution is:

function location($herf) {
    echo ("<script>window.location.href='".$herf."'</script>");
}
0

精彩评论

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