【发布时间】:2017-10-06 22:16:03
【问题描述】:
我需要在我的 Android 应用程序 WebView 中显示一个 iframe,该 iframe 存在于一个位于 Web 服务器上的 HTML 文件中。 在根据用户输入在 WebView 中显示它之前,我需要向 iframe 源添加一个参数。
我的php代码:
<?php
if (isset($_POST['amount'])){
$amount = $_POST['amount'];
$intamount = (int)$amount;
echo $intamount;
}
if (isset($_POST['currency'])){
$currency = $_POST['currency'];
$intcurrency = (int)$currency;
}
if (isset($_POST['lan'])){
$lan = $_POST["lan"];
}
if (isset($_POST['email'])){
$email_address = $_POST["email"];
}
if (isset($_POST['name'])){
$name = $_POST['name'];
}
$iframe_source = 'https://sampleurl.php?sum='.$intamount.'¤cy='.$intcurrency.'&cred_type=1&trButtonColor=008080&email='.$email_address.'&contact='.$name;
echo $iframe_source;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<iframe width="370" height="455" src="<?php
echo $iframe_source;
?>" frameborder="5" allowfullscreen></iframe>
</body>
</html>
例如,我可以向 php 文件发出 post 请求吗?如果是,有没有办法在 php 文件中添加 html 代码并将其显示在我的 WebView 中? 有一个更好的方法吗? 非常感谢。
【问题讨论】:
-
这不是一个真实的来源,它只是一个例子,我需要能够根据用户输入从我的 Android 应用程序中调整它
-
当然,sampleurl 只是一个例子,真实的是你提供的格式,它工作正常,我猜是在接收参数之前显示 iframe,它可能是我收到该错误的原因
标签: php android html iframe android-webview