这是我的PHP代码:
<?php
mysql_connect("localhost","root","");
mysql_select_db("sowrun_mobile");
$ad_id = $_REQUEST['ad_id'];
$sql=mysql_query("SELECT * FROM tbl_user_registration where reg_AD_ID='".$ad_id."'");
$row='';
while($row=mysql_fetch_assoc($sql)){
$output[]=$row;
}
if($row == ''){
$out['reg_AD_ID'] = '111111';
$output[]=$out;
}
$jsonStr = json_encode($output);
print($jsonStr);
mysql_close();
?>
我正在尝试adid
使用以下方法从Worklight适配器发送参数:
function getFeeds() {
WL.Logger.debug("inside method");
var input = {
method : 'get',
returnedContentType : 'json',
path : "ios/ClientadID.php"
};
ClientadID.php
包含上面第一个代码示例中编写的代码。
我在尝试调用过程时尝试使用以下参数从适配器发送请求。在参数窗口中,我正在发送,ad_id=1
但抛出错误:
注意:未定义的索引:第6行的C:\ wamp \ www \ ios \ ClientadID.php中的ad_id
我不确定“在参数窗口中”是什么意思。当您从Worklight Studio调用Worklight适配器时,出现的参数窗口是这样,您可以将参数传递给适配器功能,而不是REST参数。
function getFeeds(myParameter) {
// myParameter is what is passed from the parameter window
WL.Logger.debug("inside method");
var input = {
method : 'get',
returnedContentType : 'json',
path : "ios/ClientadID.php"
};
如果您尝试为GET或POST请求传递参数,则需要像这样更改适配器的“输入”对象:
function getFeeds() {
WL.Logger.debug("inside method");
var input = {
method : 'get',
returnedContentType : 'json',
path : "ios/ClientadID.php",
parameters: {"ad_id": 1}
};
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句