Haxe / PHP 服务器在不编译文件的情况下更改输出

Haxe / PHP server changing output without compiling file

我正在用 Haxe 制作一个网络应用程序并将其编译为 PHP。我在本地服务器 (php -S) 上测试了 PHP 代码。

代码如下:

    //...
    switch(page) {
        //...
        case "user":
            //if logged in, display profile; if not, redirect to login

            var loggedIn = false;

            //check if user is logged in
            if (Session.exists("username") && Session.exists("password")) {
                var username:String = Session.get("username");
                var password:String = Session.get("password");

                //check the password
                var conn = Mysql.connect({user: "..." pass: "...", host: "127.0.0.1", database: "..."});
                var dbpass = conn.request("SELECT password FROM users WHERE username = \'" + username + "\';").results().first().password;

                if (password == dbpass)
                    loggedIn = true;
            }

            if (!loggedIn) {
                returnPage += File.getContent("../html/login.html");
            } else {
                //TODO add profile page
            }
    }

服务器报错(编译时没有报错):

uncaught exception: Unable to call <exists>

in file: /.../lib/haxe/ds/StringMap.class.php line 31
#0 /.../lib/Open.class.php(9): haxe_ds_StringMap->__call('exists', Array)
#1 /.../open/index.php(11): Open::main()
#2 {main}

这就是真正奇怪的部分开始的地方:当我更改代码中的某些内容时(它不一定会影响应用程序,即使是评论也可以),不要构建它 并重新加载页面,它突然起作用了。但是当我构建代码时,它再次给出错误。

是服务器出了问题还是我哪里出错了?


编辑

我将测试服务器移至Apache,问题依旧。

我发现 StringMap class 中的 exists 函数出于某种原因没有被编译为 PHP,所以我将代码编辑为像这样:

//...
if (Session.get("username") != null && Session.get("password") != null) {

现在可以使用了。不知道为什么我没有编译文件时输出改变了,但这没关系。