BlackBerry PhoneGap App调用PHP不起作用

时间:2013-07-29 21:10:33

标签: blackberry cordova cross-domain blackberry-webworks

我创建了一个单独的网页,其中包含一个调用PHP的表单,以便从中获取一些数据。但是当我通过PhoneGap制作这个网页的应用程序并在Blackberry手机上下载时。它没有收到任何数据。同时,当我通过黑莓浏览器看到我的网页时,我可以使用所需的数据查看我的网页。可能的原因是什么?

此index.html(适用于PhoneGap)

<!DOCTYPE html>
<html>
    <head>
        <title>Mobile </title>
    </head>
    <body>
        <form name="input" action="http://lowenstern.com.ar/test.php" method="post">`enter code here`
            <input type="submit" value="Submit">
        </form> 
    </body>
</html>

config.xml(适用于PhoneGap或WebWorks,以及BlackBerry Developer中的示例)

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="2.0"
        rim:header="RIM-Widget: rim/widget">

  <author href="http://www.example.com/"
          rim:copyright="Copyright 1998-2012 My Corp">My Corp</author>

  <rim:navigation mode="focus" />

  <name>Sample application</name>

  <description>
    A sample application to demonstrate some features.
  </description>

  <rim:orientation mode="auto"/>

  <rim:loadingScreen backgroundImage="background.png"
                     foregroundImage="foreground.gif"
                     onLocalPageLoad="true">
    <rim:transitionEffect type="zoomIn" />
  </rim:loadingScreen>

  <icon src="icons/example.png"/>

  <rim:cache maxCacheSizeTotal="2048" maxCacheSizeItem ="256" />

  <content src="index.html" ></content>

  <feature id="blackberry.ui.dialog"/>

  <access uri="http://lowenstern.com.ar" subdomains="true">
    <feature id="blackberry.pim.memo"/>
    <feature id="blackberry.app"/>
    <feature id="blackberry.invoke.MemoArguments"/>
  </access>

  <rim:connection timeout="25000">
    <id>TCP_WIFI</id>
    <id>MDS</id>
    <id>BIS-B</id>
    <id>TCP_CELLULAR</id>
    <id>WAP2</id>
    <id>WAP</id>
  </rim:connection>

  <license>
    Example license
    Copyright (c) 2012 My Corp.
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
    WHETHER IN AN ACTION OF CONTRACT, INSULT OR OTHERWISE, ARISING 
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
    OTHER DEALINGS IN THE SOFTWARE.
  </license>

</widget>

test.php

<?php
    echo 'Hello World';
?>

有什么想法吗?

提前致谢!!!

1 个答案:

答案 0 :(得分:1)

权限是这里的主要嫌疑人。检查您的config.xml文件,确保您拥有正确的access条目。记住这一个:

<access subdomains="true" uri="*" />

应该禁用域限制,但不能使用ajax调用。因此,请务必为您的域添加access元素。