Home >Backend Development >PHP Tutorial > autoload函数,无法预期的EOF有关问题

autoload函数,无法预期的EOF有关问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 13:12:27931browse

autoload函数,无法预期的EOF问题
用autoload函数时,出现错误unexpected "EOF" 。但是去掉autoload函数,就好了。。。。这是什么情况?

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php function __autoload($className){ 
    {
        include_once $className.".class.php";
    }
    
    switch($_GET["action"])
    {
        case "login":
            break;
        case "":
            break;
        case "":
            break;
        case "":
            break;
        case "":
            break;
        case "":
            break;
        case "":
            break;
    }
?>  //这行有错误 unexpected "EOF" 



------解决方案--------------------
PHP code
function __autoload($className){ 
    { // 这儿多了一个,如果你用一些IDE的话,在编辑时就会提示你出错了
        include_once $className.".class.php";
    } <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn