Android 앱 WebView에 iframe을 표시해야하는 경우 iframe은 웹 서버에있는 HTML 파일에 있습니다. 사용자 입력에 따라 WebView에 표시하기 전에 매개 변수를 iframe 소스에 추가해야합니다. 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이 표시된다고 생각하는데, 그 이유는 내가 그 오류를 얻는 이유일지도 모른다. –