Home > Backend Development > PHP Tutorial > php基础教程——学习小结

php基础教程——学习小结

WBOY
Release: 2016-06-13 12:13:35
Original
983 people have browsed it

php基础教程——学习总结

一、php和表单

1.POST方法手动发送数据:

二者部分区别:

GET:

1.将信息聚集起来作为URL一部分传送

2.传送数量有限

3.公开传送,诸如密码信息会暴露

4.创建的表单可以添加为书签。

POST:

1.传递的信息用户看不到


用法示例:

html文件:ws.html

   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title> 
Copy after login
Copy after login

Name:

Copy after login
Copy after login
php文件:handle.php

   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title>  
Copy after login
Copy after login
<?phpini_set (&#39;display_errors&#39;, 1);error_reporting(E_ALL|E_STRICT);$title=$_POST[&#39;title&#39;];$name =$_POST[&#39;name&#39;];</span>print "<p> hello $title $name";?>  </p>
Copy after login
输入:myname

结果:hello Mr myname

2.GET传送数据

   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title> 
Copy after login
Copy after login

php文件:handle.php

   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title>  
Copy after login
Copy after login
<?phpini_set (&#39;display_errors&#39;, 1);error_reporting(E_ALL|E_STRICT);$name=$_GET[&#39;name&#39;];print "hello $name";?>
Copy after login
  
Copy after login


二、相关函数学习

1.格式化数值:

round(要格式化的数字 ,  保留小数点位数);

eg:$test=5.555555555;         round(test, 2); // 5.55

number_format(数字, 小数点位数, 代替小数点的符号, 千位分隔符)

eg:number_format("10000000", 2 ,"," ,".");// 10.000.000,00

2.随机函数rand()

eg:rand(0, 100);//产生0-100 随机一个数


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template