2

我是唯一一个对此有问题的人吗?我现在没有确切的代码,但它类似于以下内容......(这是我用来启动和运行 TideSDK 的最简单的示例)

我的 index.html 中有...

<script>
    Titanium.include("testLibrary.php")
</script>
<script>
    var testresult = new testMethod();
    document.write(testresult);
</script>

我在资源目录中的 testLibrary.php 文件非常简单...

<?php
    function testMethod()
    {
        $fixedResult = "The most basic php variable for display in the DOM";
        return $fixedResult;
    }

我为打包等打开了 php。当我在索引文件中包含 php 代码时一切正常,所以我知道 php 正在工作,我只是无法让 include 工作?

4

1 回答 1

2

将我的评论移至答案,因为不确定 WikingFrog 是否通过电子邮件收到通知:评论

你为什么在方法上调用 new ?var testresult = testMethod();应该管用

此外,您不需要<?php.php 文件中的 open 标记,这可能是您问题的根源。

于 2012-11-09T20:29:31.140 回答