2011-09-28 59 views
0
function goto($herf) { 
    echo ("<script>window.location.href='".$herf."'</script>"); 
} 

上述功能在php 5.3.5之前工作良好,在我將php升級到5.3.5之後,出現以下錯誤。老功能不工作在PHP 5.35

解析錯誤:語法錯誤,意想不到的T_GOTO,期待T_STRING或 '(' 在C:\ XAMPP \ htdocs中\在線目錄\目錄\目錄\目錄\ file.php 9

什麼是錯誤參考?

+1

你不使用'header(「Location; http://「);'而不是? 另外,當您調用此函數時,$ href是什麼? – Lucas

回答

2

所以,解決辦法是:

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