我照着书上打了一串代码,功能是让用户输入一串字符然后打印出来。
<html><head><title> Building a From</title></head><body><?php$search=htmlentities($_POST["search"]);$self=htmlentities($_SERVER['PHP_SELF']);if($search===''){ echo(' <form action="'.$self.'" method="POST"> <label>搜索:<input type="text" name="search" /></label> <input type="submit" name="anniu" value="搜索!"/> </form> ');}else{ echo "您输入的是:$search";}?></body></html>
head 里面加上: 这句
不知道是不是头信息原因,如果是的话用PHP的header("Content-Type:text/html;charset=UTF-8");会比输出html标签好一些
nbsp;html>
这两不要忘
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号