사용자가 값을 가져 와서 $ html = file_get_html ( '')에 넣고 페이지에 출력 값을 표시하는 양식 텍스트 상자에 값을 입력하도록합니다.
<form action="dex.php" method="POST">
<b>Site:</b><input type="text" name="site" />
<input type="submit" name="submit" value="Search" />
</form>
<?php
include('simple_html_dom.php');
$html = str_get_html('site');
echo htmlspecialchars($_POST['site']);
$html->find('div', 1)->class = 'bar';
$html->find('div[id=site]', 0)->innertext = 'foo';
//echo $html; here doesn't show webpage just results
$html = file_get_html('http://www.myrobotbuddy.com');
//$html - file_get_html(' '); from form input
echo file_get_html('$html')->plaintext;
echo $html; //shows website also
?>
나는 당신이 달성하고 싶은 것을 추측하고 있지만 :
먼저 변수에 양식 입력을 가져옵니다.
if (isset($_POST['submit'])) {
$site = htmlspecialchars($_POST['site']);
}
그때:
if(isset($site)){
$html = str_get_html($site);
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다