Heim > Artikel > Backend-Entwicklung > 请问 input text 怎么传递给 php 的函数
大家好我是PHP新手,会一点HTML和VB.NET。最近在学习PHP,请大家帮忙指点下
<html><body><div align="center"><input id="url" name="url" type=text></div></body></html><?php $url = ' 这里需要接收input text提交的网址 '; $ch = curl_init($url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); curl_setopt($ch,CURLOPT_TIMEOUT,5); $html = curl_exec($ch); if($html !== false){ /*echo $html;*/ $fname="vb.htm"; $fd=fopen($fname,"w"); $ok=fwrite($fd,$html); fclose($fd); }?>
<html><body><div align="center"><form name="form1" method="post"><input id="url" name="url" type=text></form></div></body></html> <?php $url = isset($_POST['url'])? $_POST['url'] : ''; $ch = curl_init($url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); curl_setopt($ch,CURLOPT_TIMEOUT,5); $html = curl_exec($ch); if($html !== false){ /*echo $html;*/ $fname="vb.htm"; $fd=fopen($fname,"w"); $ok=fwrite($fd,$html); fclose($fd); }?>