【问题标题】:Is there an issue using Titanium.include() in 1.2.0 RC4?在 1.2.0 RC4 中使用 Titanium.include() 有问题吗?
【发布时间】:2012-11-01 16:00:00
【问题描述】:

我是唯一一个对此有问题的人吗?我现在还没有确切的代码,但它类似于以下内容...(这是我用来启动和运行 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 工作??

【问题讨论】:

  • 你为什么在方法上调用 new ?试试 var testresult = testMethod();
  • 另外,你不需要

标签: php tidesdk


【解决方案1】:

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

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

另外,您不需要在 .php 文件中打开 &lt;?php 标记,这可能是您问题的根源。

【讨论】:

  • 魔术,感谢您的意见。 '新'来自于我在其他地方找到的一个例子,我的错。不带 php 标签就可以试一试,看看我是怎么做的。
猜你喜欢
  • 1970-01-01
  • 2012-09-14
  • 1970-01-01
  • 1970-01-01
  • 2011-09-23
  • 1970-01-01
  • 1970-01-01
  • 2011-10-20
  • 1970-01-01
相关资源
最近更新 更多