PHP uniqid() 函数基于微秒级的当前时间,生成一个唯一的 ID

2018-10-18 2010 次阅读
定义和用法uniqid() 函数基于微秒级的当前时间,生成一个唯一的 ID。语法uniqid(prefix,more_entropy)参数描述prefix可选。为 ID 规定前缀。如果两个脚本恰好在相同的微秒生成 ID,该参数很有用。more_entropy可选。规定位于返回值末尾的更多的熵。说明如果 prefix 参数为空,则返回的字...

PHP中htmlentities和 htmlspecialchars区别

2018-10-17 2110 次阅读
要理解两者的差别,先看两个文档说明:1. 简介:    html_entity_decode — Convert all HTML entities to their applicable characters    htmlentities — Convert all applicable characters to HTML entities    htmlspecia...

PHP输出HTML及转义的函数

2018-10-17 1755 次阅读
htmlentities() 函数把字符转换为 HTML 实体。html_entity_decode() 函数把 HTML 实体转换为字符。比如代码:$s="<a>1</a>";$b = htmlentities($s);//&lt;a&gt;a&lt;/a&gt; $c = html_entity_decode($s);//<a>1</a>语法:htmlen...

php下foreach()错误提示Warning: Invalid argument supplied for foreach()

2018-08-28 1837 次阅读
错误提示 Warning:Invalid argument supplied for foreach() 的中文意思是说foreach需要是一个数组而给它的是一个无效的参数.就是在循环前面加上判断,直接使用is_array判断给的值是不是为数组,代码如下:if(is_array($items) && !empty($items)){  foreach( )  }或者强...

PHP 运算符

2018-08-27 1724 次阅读
PHP 算数运算符运算符名称例子结果+加法$x + $y$x 与 $y 求和-减法$x - $y$x 与 $y 的差数*乘法$x * $y$x 与 $y 的乘积/除法$x / $y$x 与 $y 的商数%模数$x % $y$x 除 $y 的余数实例$x=10;$y=6;echo ($x + $y); // 输出 16echo ($x - $y); // 输出 4echo ($x * $y); // 输出 60echo ($x ...